diff --git a/.github/workflows/taxreport-loadtest-ondemand.yml b/.github/workflows/taxreport-loadtest-ondemand.yml index 81fb365..9912875 100644 --- a/.github/workflows/taxreport-loadtest-ondemand.yml +++ b/.github/workflows/taxreport-loadtest-ondemand.yml @@ -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 diff --git a/performance-tests/generate-tokens/src/generate-tokens.js b/performance-tests/generate-tokens/src/generate-tokens.js index 07be556..156e3c8 100644 --- a/performance-tests/generate-tokens/src/generate-tokens.js +++ b/performance-tests/generate-tokens/src/generate-tokens.js @@ -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; });