diff --git a/.github/workflows/verdaccio-load-test.yml b/.github/workflows/verdaccio-load-test.yml deleted file mode 100644 index 4c7828bc..00000000 --- a/.github/workflows/verdaccio-load-test.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Verdaccio Load Test - -on: - workflow_dispatch: - inputs: - verdaccioAuthToken: - description: Verdaccio auth token - default: 'token' - required: true - type: string - usersCount: - description: Users count - default: '200' - required: false - type: string - rampDuration: - description: Ramp duration (up and down) - default: '1m' - required: false - type: string - stableDuration: - description: Stable duration - default: '10m' - required: false - type: string - -jobs: - build: - name: Run Verdaccio load test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Run k6 Verdaccio load test - uses: grafana/k6-action@v0.3.1 - with: - filename: verdaccio/load-tests/scripts/load-test.js - env: - VERDACCIO_AUTH_TOKEN: ${{secrets.VERDACCIO_AUTH_TOKEN}} - USERS_COUNT: ${{inputs.usersCount}} - RAMP_DURATION: ${{inputs.rampDuration}} - STABLE_DURATION: ${{inputs.stableDuration}} diff --git a/verdaccio/Dockerfile b/verdaccio/Dockerfile deleted file mode 100644 index 11aeb309..00000000 --- a/verdaccio/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM verdaccio/verdaccio:5.29.0 as common - -FROM common as builder -USER root -ENV NODE_ENV=production -RUN npm i --global-style verdaccio-static-token@1.0.1 -RUN npm i --global-style verdaccio-okta-oauth@20.2.0 - -FROM common -COPY --from=builder /opt/verdaccio/node_modules/verdaccio-static-token /verdaccio/plugins/verdaccio-static-token -COPY --from=builder /opt/verdaccio/node_modules/verdaccio-okta-oauth /verdaccio/plugins/verdaccio-okta-oauth diff --git a/verdaccio/load-tests/.prettierrc b/verdaccio/load-tests/.prettierrc deleted file mode 100644 index 2b8c78cd..00000000 --- a/verdaccio/load-tests/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "printWidth": 100, - "tabWidth": 4, - "singleQuote": true, - "quoteProps": "consistent", - "arrowParens": "avoid", - "endOfLine": "auto" -} diff --git a/verdaccio/load-tests/README.md b/verdaccio/load-tests/README.md deleted file mode 100644 index ba8ae69b..00000000 --- a/verdaccio/load-tests/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Verdaccio Load Tests - -### Setup - -Install K6 - -#### MacOS - -```bash -brew install k6 -``` - -#### Windows - -```bash -choco install k6 -``` - -### Tests - -#### Load Test - -Tests an average load over a medium period of time. - -```bash -k6 run --env VERDACCIO_AUTH_TOKEN={token} scripts/load-test.js -``` - -#### Stress Test - -Tests a high load over a medium period of time. - -```bash -k6 run --env VERDACCIO_AUTH_TOKEN={token} scripts/stress-test.js -``` - -#### Spike Test - -Tests a very high load over a very short period of time. - -```bash -k6 run --env VERDACCIO_AUTH_TOKEN={token} scripts/spike-test.js -``` - -#### Soak Test - -Tests an average load over a long period of time. - -```bash -k6 run --env VERDACCIO_AUTH_TOKEN={token} scripts/soak-test.js -``` diff --git a/verdaccio/load-tests/scripts/common.js b/verdaccio/load-tests/scripts/common.js deleted file mode 100644 index 9da58470..00000000 --- a/verdaccio/load-tests/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -import http from 'k6/http'; -import { check, fail } from 'k6'; - -export const SERVER_URL = 'https://verdaccio.st.dev'; -export const PACKAGE_NAME = '@servicetitan/marketing-review-engine'; -export const AUTH_TOKEN = __ENV.VERDACCIO_AUTH_TOKEN; - -export function requestTarball() { - const headers = { Authorization: `Bearer ${AUTH_TOKEN}` }; - const params = { headers }; - - // Request package.json - const initialResponse = http.get(`${SERVER_URL}/${PACKAGE_NAME}`, params); - if (!check(initialResponse, { 200: r => r.status === 200 })) { - console.log(initialResponse); - fail('initial response was not 200'); - } - - // Get latest tag, and then get tarball url based on that tag - const latestTag = initialResponse.json('dist-tags.latest'); - const escapedLatestTag = latestTag.replace(/\./g, '\\.'); - const tarballUrl = initialResponse.json(`versions.${escapedLatestTag}.dist.tarball`); - - // Request tarball - const tarballResponse = http.get(tarballUrl, params); - if (!check(tarballResponse, { 200: r => r.status === 200 })) { - fail('tarball response was not 200'); - } -} diff --git a/verdaccio/load-tests/scripts/load-test.js b/verdaccio/load-tests/scripts/load-test.js deleted file mode 100644 index 7a694c76..00000000 --- a/verdaccio/load-tests/scripts/load-test.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Load test with the purpose of to determine how Verdaccio responses under an average load. - * - * Ramps up the number of users over x minutes, then keeps the load stable for x mins, - * and then ramps down over x min. - */ - -import { sleep } from 'k6'; -import { requestTarball } from './common.js'; - -const USERS_COUNT = __ENV.USERS_COUNT ? Number(__ENV.USERS_COUNT) : 200; -const RAMP_DURATION = __ENV.RAMP_DURATION || '1m'; -const STABLE_DURATION = __ENV.STABLE_DURATION || '10m'; - -export const options = { - stages: [ - { duration: RAMP_DURATION, target: USERS_COUNT }, // ramp-up - { duration: STABLE_DURATION, target: USERS_COUNT }, // stable - { duration: RAMP_DURATION, target: 0 }, // ramp-down - ], -}; - -export default () => { - requestTarball(); - sleep(1); // wait 1 second -}; diff --git a/verdaccio/load-tests/scripts/soak-test.js b/verdaccio/load-tests/scripts/soak-test.js deleted file mode 100644 index 3b3bcbad..00000000 --- a/verdaccio/load-tests/scripts/soak-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Soak test with the purpose of testing an average load over a long period of time. - */ - -import { sleep } from 'k6'; -import { requestTarball } from './common.js'; - -const RAMP_DURATION = '5m'; -const STABLE_DURATION = '8h'; -const USERS_COUNT = 200; - -export const options = { - stages: [ - { duration: RAMP_DURATION, target: USERS_COUNT }, - { duration: STABLE_DURATION, target: USERS_COUNT }, - { duration: RAMP_DURATION, target: 0 }, - ], -}; - -export default () => { - requestTarball(); - sleep(1); // wait 1 second -}; diff --git a/verdaccio/load-tests/scripts/spike-test.js b/verdaccio/load-tests/scripts/spike-test.js deleted file mode 100644 index 40589ee7..00000000 --- a/verdaccio/load-tests/scripts/spike-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Spike test with the purpose of testing a sudden spike in traffic that quickly dies off. - */ - -import { sleep } from 'k6'; -import { requestTarball } from './common.js'; - -const RAMP_DURATION = '30s'; -const STABLE_DURATION = '2m'; -const USERS_COUNT = 500; - -export const options = { - stages: [ - { duration: RAMP_DURATION, target: USERS_COUNT }, // ramp up - { duration: STABLE_DURATION, target: USERS_COUNT }, // stable - { duration: RAMP_DURATION, target: 0 }, // ramp-down to 0 users - ], -}; - -export default () => { - requestTarball(); - sleep(1); // wait 1 second -}; diff --git a/verdaccio/load-tests/scripts/stress-test.js b/verdaccio/load-tests/scripts/stress-test.js deleted file mode 100644 index 8115e63d..00000000 --- a/verdaccio/load-tests/scripts/stress-test.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Stress test with the purpose of seeing how Verdaccio handles an increased load. - * - * Ramps up the number of requests over x mins, keeps stable for x mins, - * then repeats 2 times before ramping down. - * - * Numbers can be increased until the server fails to test the limit. - */ - -import { sleep } from 'k6'; -import { requestTarball } from './common.js'; - -const RAMP_UP_DURATION = '30s'; -const STABLE_DURATION = '30s'; -const USERS_COUNT_STAGE_ONE_TARGET = 200; -const USERS_COUNT_STAGE_TWO_TARGET = 400; -const USERS_COUNT_STAGE_THREE_TARGET = 500; - -export const options = { - stages: [ - { duration: RAMP_UP_DURATION, target: USERS_COUNT_STAGE_ONE_TARGET }, // ramp up - { duration: STABLE_DURATION, target: USERS_COUNT_STAGE_ONE_TARGET }, // stable - { duration: RAMP_UP_DURATION, target: USERS_COUNT_STAGE_TWO_TARGET }, // ramp up - { duration: STABLE_DURATION, target: USERS_COUNT_STAGE_TWO_TARGET }, // stable - { duration: RAMP_UP_DURATION, target: USERS_COUNT_STAGE_THREE_TARGET }, // ramp up - { duration: STABLE_DURATION, target: USERS_COUNT_STAGE_THREE_TARGET }, // stable - { duration: STABLE_DURATION, target: 0 }, // ramp-down to 0 users - ], -}; - -export default () => { - requestTarball(); - sleep(1); // wait 1 second -};