Skip to content

Commit

Permalink
Set may Payload size
Browse files Browse the repository at this point in the history
  • Loading branch information
ausias-armesto committed May 23, 2024
1 parent fe27e70 commit 23dd983
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions k6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"test": "npm run test:local",
"test:local": "npm run webpack && K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true K6_OUT=xk6-prometheus-rw K6_PROMETHEUS_RW_SERVER_URL=https://prometheus.staging.hoprnet.link/api/v1/write ./k6 run ./dist/constant-traffic.test.js",
"test:pluto": "docker-compose down; docker-compose up 1&> /dev/null &",
"test:rotsee": "npm run webpack && ENVIRONMENT_NAME=rotsee K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true K6_OUT=xk6-prometheus-rw K6_PROMETHEUS_RW_SERVER_URL=https://prometheus.staging.hoprnet.link/api/v1/write ./k6 run --summary-export=result.json --tag testid=local ./dist/constant-traffic.test.js",
"test:dufour": "npm run webpack && ENVIRONMENT_NAME=dufour K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true K6_OUT=xk6-prometheus-rw K6_PROMETHEUS_RW_SERVER_URL=https://prometheus.staging.hoprnet.link/api/v1/write ./k6 run --summary-export=result.json --tag testid=local ./dist/constant-traffic.test.js",
"test:rotsee": "npm run webpack && ENVIRONMENT_NAME=rotsee K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true K6_OUT=xk6-prometheus-rw K6_PROMETHEUS_RW_SERVER_URL=https://prometheus.staging.hoprnet.link/api/v1/write ./k6 run --summary-export=test-execution-local.json --tag testid=local ./dist/constant-traffic.test.js",
"test:dufour": "npm run webpack && ENVIRONMENT_NAME=dufour K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true K6_OUT=xk6-prometheus-rw K6_PROMETHEUS_RW_SERVER_URL=https://prometheus.staging.hoprnet.link/api/v1/write ./k6 run --summary-export=test-execution-local.json --tag testid=local ./dist/constant-traffic.test.js",
"test:rotsee:setup": "npm run build && ENVIRONMENT_NAME=rotsee node ./dist/setup-environment.js",
"test:dufour:setup": "npm run build && ENVIRONMENT_NAME=dufour node ./dist/setup-environment.js"
},
Expand Down
4 changes: 3 additions & 1 deletion k6/src/k6/constant-traffic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { check, fail, sleep } from 'k6'
import ws from 'k6/ws';
// 1. Begin Init section
const environmentName = __ENV.ENVIRONMENT_NAME || 'local'
const PACKET_PAYLOAD_SIZE = 480; // It supports 500 bytes of payload but we are using 480 bytes to avoid errors

// Load nodes
const nodesData = JSON.parse(open(`./nodes-${environmentName}.json`))
Expand Down Expand Up @@ -84,9 +85,10 @@ export function multipleHopMessage (dataPool: { senders: HoprdNode[], nodes: Hop
}
let pathNames = nodesPath.map((node: HoprdNode) => node.name).join(' -> ');
let pathPeerIds = nodesPath.map((node: HoprdNode) => node.peerId);
let body = randomString(PACKET_PAYLOAD_SIZE);

console.log(`[VU:${execution.vu.idInInstance}] - Sending ${hops} hops message ${senderHoprdNode.name} (source) -> [${pathNames}] -> ${senderHoprdNode.name} (destination)`)
sendMessage(senderHoprdNode.url, senderHoprdNode.httpParams, JSON.stringify({ tag: nodeIndex, body: randomString(15), path: pathPeerIds, peerId: senderHoprdNode.peerId, hops }))
sendMessage(senderHoprdNode.url, senderHoprdNode.httpParams, JSON.stringify({ tag: nodeIndex, body, path: pathPeerIds, peerId: senderHoprdNode.peerId, hops }))
}

export function teardown() {
Expand Down

0 comments on commit 23dd983

Please sign in to comment.