From 7cc82ee36b03d22824891844e571cd05e0c150da Mon Sep 17 00:00:00 2001 From: John David White <122345776@umail.ucc.ie> Date: Sat, 28 Mar 2026 14:13:59 +0000 Subject: [PATCH 1/2] Add load tests --- test/load/test_aws.js | 18 ++++++++++++++++++ test/load/test_local.js | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/load/test_aws.js create mode 100644 test/load/test_local.js diff --git a/test/load/test_aws.js b/test/load/test_aws.js new file mode 100644 index 0000000..50bef01 --- /dev/null +++ b/test/load/test_aws.js @@ -0,0 +1,18 @@ +import http from 'k6/http'; +import { check, sleep } from 'k6'; + +export const options = { + vus: 1000, + duration: '30s', +}; + +export default function (){ + const res = http.get('https://synchro-accelerator.com/takehiro_load'); + + check(res, { + 'status is 200': (r) => r.status === 200, + 'response time < 100ms': (r) => r.timings.duration < 100, + }); + + sleep(1); +} diff --git a/test/load/test_local.js b/test/load/test_local.js new file mode 100644 index 0000000..cdb6439 --- /dev/null +++ b/test/load/test_local.js @@ -0,0 +1,25 @@ +import http from 'k6/http'; +import { check, sleep } from 'k6'; + +export const options = { + stages: [ + { duration: '30s', target: 10 }, + { duration: '30s', target: 50 }, + { duration: '30s', target: 100 }, + { duration: '10s', target: 0 }, + ], + thresholds: { + http_req_duration: ['p(95)<100'], + http_req_failed: ['rate<0.01'], + }, +}; + +export default function () { + const baseURL = __ENV.GATEWAY_URL || 'http://localhost:8080'; + const res = http.get(`${baseURL}/takehiro_load`); + + check(res, { + 'status is 200': (r) => r.status === 200, + 'response time < 100ms': (r) => r.timings.duration < 100, + }); +} \ No newline at end of file From 7fe97fbd09e1f710329787d4ff53bad84472600b Mon Sep 17 00:00:00 2001 From: John David White <122345776@umail.ucc.ie> Date: Mon, 30 Mar 2026 13:44:25 +0100 Subject: [PATCH 2/2] Refactor load tests --- test/load/test_aws.js | 2 -- test/load/test_local.js | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/test/load/test_aws.js b/test/load/test_aws.js index 50bef01..e55adef 100644 --- a/test/load/test_aws.js +++ b/test/load/test_aws.js @@ -13,6 +13,4 @@ export default function (){ 'status is 200': (r) => r.status === 200, 'response time < 100ms': (r) => r.timings.duration < 100, }); - - sleep(1); } diff --git a/test/load/test_local.js b/test/load/test_local.js index cdb6439..5a47798 100644 --- a/test/load/test_local.js +++ b/test/load/test_local.js @@ -2,21 +2,12 @@ import http from 'k6/http'; import { check, sleep } from 'k6'; export const options = { - stages: [ - { duration: '30s', target: 10 }, - { duration: '30s', target: 50 }, - { duration: '30s', target: 100 }, - { duration: '10s', target: 0 }, - ], - thresholds: { - http_req_duration: ['p(95)<100'], - http_req_failed: ['rate<0.01'], - }, + vus: 50, + duration: '30s' }; export default function () { - const baseURL = __ENV.GATEWAY_URL || 'http://localhost:8080'; - const res = http.get(`${baseURL}/takehiro_load`); + const res = http.get('http://localhost:8080/zutto_products'); check(res, { 'status is 200': (r) => r.status === 200,