Skip to content

Commit

Permalink
fixup! feat: add web socket server load tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iccicci committed Jul 15, 2024
1 parent 8c28f7c commit 95769a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/k6-web-socket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
-e TARGET_NET=${{ inputs.network }}
-e WALLETS=${{ inputs.wallets }}
--out json=web-socket-results.json
--quiet
- name: Upload performance test results
uses: actions/upload-artifact@v3
with:
Expand Down
12 changes: 9 additions & 3 deletions packages/e2e/test/k6/scenarios/web-socket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ import { check } from 'k6';
import ws from 'k6/ws';

// eslint-disable-next-line no-undef
const { TARGET_ENV, TARGET_NET, WALLETS } = __ENV;
const url = `wss://${TARGET_ENV}-${TARGET_NET}${TARGET_ENV === 'ops' ? '-1' : ''}.lw.iog.io/`;
const { TARGET_ENV, TARGET_NET, URL, WALLETS } = Object.assign({ WALLETS: '10000' }, __ENV);
const url = TARGET_ENV ? `wss://${TARGET_ENV}-${TARGET_NET}${TARGET_ENV === 'ops' ? '-1' : ''}.lw.iog.io/` : URL;

if (TARGET_ENV && !['dev', 'ops', 'staging', 'prod'].includes(TARGET_ENV))
throw new Error(`Not valid TARGET_ENV: ${TARGET_ENV}`);
if (TARGET_NET && !['preview', 'preprod', 'sanchonet', 'mainnet'].includes(TARGET_NET))
throw new Error(`Not valid TARGET_NET: ${TARGET_NET}`);
if (!(TARGET_ENV && TARGET_NET) && !URL) throw new Error('Please specify both TARGET_ENV and TARGET_NET or URL');

export const options = {
ext: {
Expand Down Expand Up @@ -55,7 +61,7 @@ export const run = () => {
socket.setTimeout(() => {
closed = true;
socket.close();
}, 80 * 1000);
}, 8 * 1000);
});

check(res, { 'status is 101': (r) => r && r.status === 101 });
Expand Down

0 comments on commit 95769a5

Please sign in to comment.