From 48075752bfc7686571b2c65d591aaea523d2b0e8 Mon Sep 17 00:00:00 2001 From: ausias-armesto Date: Mon, 21 Oct 2024 10:35:05 +0200 Subject: [PATCH] Adding uhttp and enabled --- k6/assets/nodes-team-all.json | 78 ++++++-------------------- k6/assets/nodes-team.json | 66 +++++++++++++++++++--- k6/assets/nodes-uhttp.json | 70 +++++++++++++++++++++++ k6/src/k6/send-messages.test.ts | 8 ++- k6/src/typescript/setup-environment.ts | 11 ++-- 5 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 k6/assets/nodes-uhttp.json diff --git a/k6/assets/nodes-team-all.json b/k6/assets/nodes-team-all.json index 0b884a5..257cb67 100644 --- a/k6/assets/nodes-team-all.json +++ b/k6/assets/nodes-team-all.json @@ -3,60 +3,58 @@ { "name": "hoprd-andrius-dappnode", "url": "http://85.206.96.234:3009/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-andrius-vps", "url": "http://173.249.13.193:3009/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ { "name": "hoprd-andrius-dappnode" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-ausias", "url": "http://85.49.63.139:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ { "name": "hoprd-andrius-dappnode" }, { "name": "hoprd-andrius-vps" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-ronny", "url": "http://178.254.33.145:3002/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, @@ -64,17 +62,16 @@ { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-q" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-tibor", "url": "http://65.109.137.126:3002/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, @@ -82,17 +79,16 @@ { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-michal", "url": "http://vlabs.ddns.net:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, @@ -100,17 +96,16 @@ { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-jean" } ] }, { "name": "hoprd-jean", - "url": "http://91.132.145.250:3101", + "url": "http://91.132.145.250:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, @@ -118,17 +113,16 @@ { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, - { "name": "hoprd-tibor" }, - { "name": "hoprd-lukas" } + { "name": "hoprd-tibor" } ] }, { "name": "hoprd-q", "url": "http://45.76.177.147:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, @@ -136,48 +130,10 @@ { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, - { "name": "hoprd-tino" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } - ] - }, - { - "name": "hoprd-tino", - "url": "http://8.8.8.8:3001/", - "isSender": true, - "isRelayer": true, - "isReceiver": true, - "routes": [ - { "name": "hoprd-andrius-dappnode"}, - { "name": "hoprd-andrius-vps" }, - { "name": "hoprd-ausias" }, - { "name": "hoprd-michal" }, - { "name": "hoprd-ronny" }, - { "name": "hoprd-q" }, - { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-lukas" } - ] - }, - { - "name": "hoprd-lukas", - "url": "http://8.8.8.8:3001/", - "isSender": true, - "isRelayer": true, - "isReceiver": true, - "routes": [ - { "name": "hoprd-andrius-dappnode"}, - { "name": "hoprd-andrius-vps" }, - { "name": "hoprd-ausias" }, - { "name": "hoprd-michal" }, - { "name": "hoprd-ronny" }, - { "name": "hoprd-q" }, - { "name": "hoprd-tibor" }, - { "name": "hoprd-jean" }, - { "name": "hoprd-tino" } + { "name": "hoprd-jean" } ] } ] diff --git a/k6/assets/nodes-team.json b/k6/assets/nodes-team.json index 48b1d49..ad15cf1 100644 --- a/k6/assets/nodes-team.json +++ b/k6/assets/nodes-team.json @@ -1,87 +1,139 @@ { "nodes": [ + { + "name": "hoprd-andrius-dappnode", + "url": "http://85.206.96.234:3009/", + "enabled": false, + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "hoprd-andrius-vps" }, + { "name": "hoprd-ausias" }, + { "name": "hoprd-michal" }, + { "name": "hoprd-ronny" }, + { "name": "hoprd-q" }, + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } + ] + }, { "name": "hoprd-andrius-vps", "url": "http://173.249.13.193:3009/", + "enabled": false, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode" }, { "name": "hoprd-ausias" }, { "name": "hoprd-michal" }, - { "name": "hoprd-q" }, { "name": "hoprd-ronny" }, - { "name": "hoprd-tibor" } + { "name": "hoprd-q" }, + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } ] }, { "name": "hoprd-ausias", "url": "http://85.49.63.139:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode" }, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-michal" }, - { "name": "hoprd-q" }, { "name": "hoprd-ronny" }, - { "name": "hoprd-tibor" } + { "name": "hoprd-q" }, + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } ] }, { "name": "hoprd-ronny", "url": "http://178.254.33.145:3002/", + "enabled": false, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, { "name": "hoprd-michal" }, { "name": "hoprd-q" }, - { "name": "hoprd-tibor" } + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } ] }, { "name": "hoprd-tibor", "url": "http://65.109.137.126:3002/", + "enabled": false, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, - { "name": "hoprd-q" } + { "name": "hoprd-q" }, + { "name": "hoprd-jean" } ] }, { "name": "hoprd-michal", "url": "http://vlabs.ddns.net:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, + { "name": "hoprd-ronny" }, { "name": "hoprd-q" }, + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } + ] + }, + { + "name": "hoprd-jean", + "url": "http://91.132.145.250:3101/", + "enabled": true, + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "hoprd-andrius-dappnode"}, + { "name": "hoprd-andrius-vps" }, + { "name": "hoprd-ausias" }, + { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, + { "name": "hoprd-q" }, { "name": "hoprd-tibor" } ] }, { "name": "hoprd-q", "url": "http://45.76.177.147:3101/", + "enabled": true, "isSender": true, "isRelayer": true, "isReceiver": true, "routes": [ + { "name": "hoprd-andrius-dappnode"}, { "name": "hoprd-andrius-vps" }, { "name": "hoprd-ausias" }, { "name": "hoprd-michal" }, { "name": "hoprd-ronny" }, - { "name": "hoprd-tibor" } + { "name": "hoprd-tibor" }, + { "name": "hoprd-jean" } ] } ] diff --git a/k6/assets/nodes-uhttp.json b/k6/assets/nodes-uhttp.json new file mode 100644 index 0000000..ec71235 --- /dev/null +++ b/k6/assets/nodes-uhttp.json @@ -0,0 +1,70 @@ +{ + "nodes": [ + { + "name": "uhttp-green-node-1", + "url": "https://uhttp-green-node-1.uhttp.staging.hoprnet.link", + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "uhttp-green-node-2" }, + { "name": "uhttp-green-node-3" }, + { "name": "uhttp-green-node-4" }, + { "name": "uhttp-green-node-5" } + ] + }, + { + "name": "uhttp-green-node-2", + "url": "https://uhttp-green-node-2.uhttp.staging.hoprnet.link/", + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "uhttp-green-node-1" }, + { "name": "uhttp-green-node-3" }, + { "name": "uhttp-green-node-4" }, + { "name": "uhttp-green-node-5" } + ] + }, + { + "name": "uhttp-green-node-3", + "url": "https://uhttp-green-node-3.uhttp.staging.hoprnet.link/", + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "uhttp-green-node-1" }, + { "name": "uhttp-green-node-2" }, + { "name": "uhttp-green-node-4" }, + { "name": "uhttp-green-node-5" } + ] + }, + { + "name": "uhttp-green-node-4", + "url": "https://uhttp-green-node-4.uhttp.staging.hoprnet.link/", + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "uhttp-green-node-1" }, + { "name": "uhttp-green-node-2" }, + { "name": "uhttp-green-node-3" }, + { "name": "uhttp-green-node-5" } + + ] + }, + { + "name": "uhttp-green-node-5", + "url": "https://uhttp-green-node-5.uhttp.staging.hoprnet.link/", + "isSender": true, + "isRelayer": true, + "isReceiver": true, + "routes": [ + { "name": "uhttp-green-node-1" }, + { "name": "uhttp-green-node-2" }, + { "name": "uhttp-green-node-3" }, + { "name": "uhttp-green-node-4" } + ] + } + ] +} diff --git a/k6/src/k6/send-messages.test.ts b/k6/src/k6/send-messages.test.ts index 1180a78..b10e4a6 100644 --- a/k6/src/k6/send-messages.test.ts +++ b/k6/src/k6/send-messages.test.ts @@ -9,8 +9,8 @@ const nodes = __ENV.NODES || 'many2many' // Load nodes const nodesData = JSON.parse(open(`./nodes-${nodes}.json`)) -const amountOfSenders = nodesData.nodes.filter((node: any) => node.isSender != undefined && node.isSender).length -const amountOfReceivers = nodesData.nodes.filter((node: any) => node.isReceiver != undefined && node.isReceiver).length +const amountOfSenders = nodesData.nodes.filter((node: any) => node.enabled && node.isSender != undefined && node.isSender).length +const amountOfReceivers = nodesData.nodes.filter((node: any) => node.enabled && node.isReceiver != undefined && node.isReceiver).length // Override API Token if (__ENV.HOPRD_API_TOKEN) { @@ -71,7 +71,9 @@ export function setup() { const senders: HoprdNode[] = [] const receivers: HoprdNode[] = [] const relayers: HoprdNode[] = [] - nodesData.nodes.forEach((node: any) => { + nodesData.nodes + .filter((node: any) => node.enabled) + .forEach((node: any) => { let hoprdNode: HoprdNode = new HoprdNode(node) if (hoprdNode.isSender) { console.log(`Setting up ${hoprdNode.name} as sender`) diff --git a/k6/src/typescript/setup-environment.ts b/k6/src/typescript/setup-environment.ts index f5c11a2..5b2c28f 100644 --- a/k6/src/typescript/setup-environment.ts +++ b/k6/src/typescript/setup-environment.ts @@ -25,8 +25,9 @@ const setupEnvironment = async (nodes: HoprdNode[]) => { } // Open channels nodes + const enabledNodes: HoprdNode[] = nodes.filter((node:HoprdNode) => node.data.enabled) const openChannels: Promise [] = [] - nodes.forEach((node:HoprdNode) => { openChannels.push(node.openChannels(nodes))}) + nodes.forEach((node:HoprdNode) => { openChannels.push(node.openChannels(enabledNodes))}) const nodePendingTransactions: string[][] = await Promise.all(openChannels) if (nodePendingTransactions.flat().length > 0 ) { @@ -43,14 +44,16 @@ const iterations = process.env.SCENARIO_ITERATIONS || 1 const duration = process.env.SCENARIO_DURATION || "30" const hoprdNodeThreads = process.env.HOPRD_NODE_THREADS || 1 const nodesData = JSON.parse(fs.readFileSync(`assets/nodes-${nodes}.json`).toString()) -const promiseNodes: HoprdNode[] = nodesData.nodes.map(async (node: any) => { +const enabledNodes: HoprdNode[] = nodesData.nodes + .filter((node: any) => node.enabled) + .map(async (node: any) => { let hoprdNode = new HoprdNode(node); await hoprdNode.init(); return hoprdNode; }); +nodesData.nodes.filter((node: any) => !node.enabled).forEach((node: any) => { console.log(`[INFO] Node ${node.name} is disabled`) }) - -Promise.all(promiseNodes).then((hoprdNodes: HoprdNode[]) => { +Promise.all(enabledNodes).then((hoprdNodes: HoprdNode[]) => { setupEnvironment(hoprdNodes).then(() => { console.log('[INFO] Environment fully setup')