Skip to content

Commit

Permalink
trying to generate tokens with k6 script
Browse files Browse the repository at this point in the history
  • Loading branch information
dagfinno committed Nov 27, 2024
1 parent f4ead98 commit 26406be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/taxreport-loadtest-ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Generate tokens
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 'stable'

- name: Install xk6
run: go install go.k6.io/xk6/cmd/xk6@latest

- name: Build xk6-counter binary
working-directory: ./performance-tests/tax-report/src
run: xk6 build --with github.com/avitalique/xk6-file@latest

- name: Run k6 to generate tokens
working-directory: ./performance-tests/tax-report/src
run: bash ../../generate-tokens/src/generate-tokens.sh ../../generate-tokens/src ${{ inputs.limit }}
run: ./k6 run ../../generate-tokens/src/generate-tokens.js
env:
API_ENVIRONMENT: ${{ secrets.YTENVIRONMENT }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKENGENUSER }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKENGENPWD }}
env: ${{ secrets.YTENVIRONMENT }}
tokengenuser: ${{ secrets.TOKENGENUSER }}
tokengenuserpwd: ${{ secrets.TOKENGENPWD }}
limit: ${{ inputs.limit }}

- name: Setup K6
uses: grafana/setup-k6-action@v1
Expand Down
2 changes: 1 addition & 1 deletion performance-tests/generate-tokens/src/generate-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const tokenGeneratorUserPwd = __ENV.tokengenuserpwd;
const limit = (__ENV.limit === undefined ? 0 : __ENV.limit);
const ttl = (__ENV.ttl === undefined ? 3600 : __ENV.ttl)

const filepath = 'data-with-tokens.csv';
const filepath = '.data-with-tokens.csv';
const idKeys = new SharedArray('idKeys', function () {
return papaparse.parse(open('data.csv'), { header: true }).data;
});
Expand Down

0 comments on commit 26406be

Please sign in to comment.