From 20f3192bba5898918944fcc1842dc446d6574924 Mon Sep 17 00:00:00 2001 From: dannymaate Date: Mon, 3 Jun 2024 14:58:41 +1000 Subject: [PATCH] Add evaluation and revise tests --- k6_test/create_menu_item.js | 5 +- k6_test/delete_menu_item.js | 50 +++++++ k6_test/get_user_info.js | 2 +- k6_test/result.txt | 255 +++++++++++++++++------------------- report/report.tex | 74 ++++++++++- 5 files changed, 247 insertions(+), 139 deletions(-) create mode 100644 k6_test/delete_menu_item.js diff --git a/k6_test/create_menu_item.js b/k6_test/create_menu_item.js index 407c494..3d398a2 100644 --- a/k6_test/create_menu_item.js +++ b/k6_test/create_menu_item.js @@ -12,8 +12,8 @@ export function uuidv4() { export const options = { stages: [ - { duration: '1m', target: 20 }, - { duration: '2m', target: 20 }, + { duration: '1m', target: 500 }, + { duration: '2m', target: 1000 }, { duration: '1m', target: 0 }, ], }; @@ -37,6 +37,5 @@ export default function () { let itemId = createItemRes.json().item_id; - sleep(1); } diff --git a/k6_test/delete_menu_item.js b/k6_test/delete_menu_item.js new file mode 100644 index 0000000..fe38bbf --- /dev/null +++ b/k6_test/delete_menu_item.js @@ -0,0 +1,50 @@ +import http from 'k6/http'; +import { check, sleep } from 'k6'; + +export function uuidv4() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = (Math.random() * 16) | 0, + v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); +} + + +export const options = { + stages: [ + { duration: '1m', target: 20 }, + { duration: '2m', target: 20 }, + { duration: '1m', target: 0 }, + ], +}; + +export default function () { + let res = http.get('http://brewbucks-485861802.us-east-1.elb.amazonaws.com/api/v1/menu_items', { + headers: { 'Content-Type': 'application/json' }, + }); + + latte_item = next(item for item in menu_items) + delete_data = { + "user_id": 1, + "item_id": latte_item["item_id"] + } + + let itemData = JSON.stringify({ + user_id: 1, + item_id: 9 + }); + + + + let delItemRes = http.del('http://brewbucks-485861802.us-east-1.elb.amazonaws.com/api/v1/menu_items', itemData, { + headers: { 'Content-Type': 'application/json' }, + }); + + check(delItemRes, { + 'item deletion status is 201': (r) => r.status === 201, + }); + + let itemId = delItemRes.json().item_id; + + sleep(1); +} diff --git a/k6_test/get_user_info.js b/k6_test/get_user_info.js index 54b3915..4f8e20e 100644 --- a/k6_test/get_user_info.js +++ b/k6_test/get_user_info.js @@ -16,7 +16,7 @@ export default function () { check(res, { 'status is 200': (r) => r.status === 200, - 'response time is < 500ms': (r) => r.timings.duration < 500, + 'response time is < 1000ms': (r) => r.timings.duration < 1000, }); sleep(1); diff --git a/k6_test/result.txt b/k6_test/result.txt index 3e2a0d9..f9fd2e5 100644 --- a/k6_test/result.txt +++ b/k6_test/result.txt @@ -1,161 +1,148 @@ execution: local - script: sign_up_and_delete_user.js - output: - + script: create_menu_item.js + output: - scenarios: (100.00%) 1 scenario, 20 max VUs, 4m30s max duration (incl. graceful stop): * default: Up to 20 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) - - ✓ user creation status is 201 - ✓ user deletion status is 200 - - checks.........................: 100.00% ✓ 7116 ✗ 0 - data_received..................: 2.5 MB 10 kB/s - data_sent......................: 1.3 MB 5.6 kB/s - http_req_blocked...............: avg=802.81µs min=137µs med=532.5µs max=13.79ms p(90)=1.93ms p(95)=2.26ms - http_req_connecting............: avg=740.19µs min=125µs med=489.5µs max=11.84ms p(90)=1.79ms p(95)=2.08ms - http_req_duration..............: avg=10.42ms min=864µs med=6.6ms max=104.76ms p(90)=23.93ms p(95)=32.13ms - { expected_response:true }...: avg=10.42ms min=864µs med=6.6ms max=104.76ms p(90)=23.93ms p(95)=32.13ms - http_req_failed................: 0.00% ✓ 0 ✗ 7116 - http_req_receiving.............: avg=136.38µs min=13µs med=46µs max=5.36ms p(90)=309µs p(95)=529.49µs - http_req_sending...............: avg=42.27µs min=4µs med=23µs max=1.36ms p(90)=97µs p(95)=124.24µs - http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...............: avg=10.24ms min=842µs med=6.41ms max=104.68ms p(90)=23.74ms p(95)=31.95ms - http_reqs......................: 7116 29.633845/s - iteration_duration.............: avg=1.02s min=1s med=1.01s max=1.11s p(90)=1.04s p(95)=1.05s - iterations.....................: 3558 14.816923/s - vus............................: 1 min=1 max=20 - vus_max........................: 20 min=20 max=20 + ✗ item creation status is 201 + ↳ 99% — ✓ 2884 / ✗ 20 + + checks.........................: 99.31% ✓ 2884 ✗ 20 + data_received..................: 1.2 MB 2.4 kB/s + data_sent......................: 877 kB 1.7 kB/s + http_req_blocked...............: avg=3.5ms min=1µs med=7µs max=384.68ms p(90)=12µs p(95)=14µs + http_req_connecting............: avg=3.48ms min=0s med=0s max=347.65ms p(90)=0s p(95)=0s + http_req_duration..............: avg=445.42ms min=243.16ms med=251.85ms max=4m35s p(90)=259.18ms p(95)=265.53ms + { expected_response:true }...: avg=445.37ms min=247.25ms med=251.84ms max=4m35s p(90)=258.91ms p(95)=265.05ms + http_req_failed................: 0.68% ✓ 20 ✗ 2884 + http_req_receiving.............: avg=359.66µs min=0s med=76µs max=26.65ms p(90)=1.16ms p(95)=1.68ms + http_req_sending...............: avg=40.13µs min=7µs med=33µs max=1.85ms p(90)=64µs p(95)=72µs + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............: avg=445.02ms min=241.3ms med=251.46ms max=4m35s p(90)=258.64ms p(95)=265.04ms + http_reqs......................: 2904 5.636031/s + iteration_duration.............: avg=1.25s min=244.14ms med=1.25s max=1.97s p(90)=1.26s p(95)=1.27s + iterations.....................: 2904 5.636031/s + vus............................: 1 min=1 max=20 + vus_max........................: 20 min=20 max=20 -running (4m00.1s), 00/20 VUs, 3558 complete and 0 interrupted iterations + running (8m35.3s), 00/20 VUs, 2904 complete and 0 interrupted iterations + default ✓ [======================================] 00/20 VUs 4m0s execution: local - script: get_user_info.js - output: - - - scenarios: (100.00%) 1 scenario, 20 max VUs, 4m30s max duration (incl. graceful stop): - * default: Up to 20 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) + script: create_order.js + output: - + + scenarios: (100.00%) 1 scenario, 2500 max VUs, 6m30s max duration (incl. graceful stop): + * default: Up to 2500 looping VUs for 6m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) + + ✗ order creation status is 201 + ↳ 78% — ✓ 47888 / ✗ 13139 + + checks.........................: 78.47% ✓ 47888 ✗ 13139 + data_received..................: 54 MB 148 kB/s + data_sent......................: 18 MB 48 kB/s + http_req_blocked...............: avg=15.13ms min=1µs med=7µs max=4.02s p(90)=12µs p(95)=243.05ms + http_req_connecting............: avg=15.11ms min=0s med=0s max=4.02s p(90)=0s p(95)=242.91ms + http_req_duration..............: avg=6.01s min=256.68ms med=2.29s max=1m0s p(90)=10.24s p(95)=14.7s + { expected_response:true }...: avg=2.98s min=256.68ms med=1.36s max=59.65s p(90)=5.93s p(95)=8.98s + http_req_failed................: 21.52% ✓ 13139 ✗ 47888 + http_req_receiving.............: avg=2.61ms min=0s med=450µs max=2.38s p(90)=4.71ms p(95)=6.82ms + http_req_sending...............: avg=35.78µs min=5µs med=31µs max=5.98ms p(90)=48µs p(95)=69µs + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............: avg=6s min=256.53ms med=2.29s max=1m0s p(90)=10.24s p(95)=14.7s + http_reqs......................: 61027 166.782394/s + iteration_duration.............: avg=7.01s min=1.25s med=3.3s max=1m1s p(90)=11.25s p(95)=15.67s + iterations.....................: 61017 166.755065/s + vus............................: 3 min=3 max=2500 + vus_max........................: 2500 min=2500 max=2500 + + + running (6m05.9s), 0000/2500 VUs, 61017 complete and 211 interrupted iterations + default ✓ [======================================] 0000/2500 VUs 6m0s - ✓ status is 200 - ✓ response time is < 500ms - - checks.........................: 100.00% ✓ 7210 ✗ 0 - data_received..................: 1.5 MB 6.1 kB/s - data_sent......................: 454 kB 1.9 kB/s - http_req_blocked...............: avg=1.72ms min=184µs med=1.91ms max=17.72ms p(90)=2.47ms p(95)=2.68ms - http_req_connecting............: avg=1.6ms min=158µs med=1.78ms max=12.92ms p(90)=2.32ms p(95)=2.52ms - http_req_duration..............: avg=6.62ms min=586µs med=6.41ms max=38.12ms p(90)=10.45ms p(95)=11.73ms - { expected_response:true }...: avg=6.62ms min=586µs med=6.41ms max=38.12ms p(90)=10.45ms p(95)=11.73ms - http_req_failed................: 0.00% ✓ 0 ✗ 3605 - http_req_receiving.............: avg=357.1µs min=17µs med=137µs max=9.16ms p(90)=1ms p(95)=1.47ms - http_req_sending...............: avg=80.91µs min=8µs med=65µs max=15.38ms p(90)=114µs p(95)=146.79µs - http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...............: avg=6.18ms min=558µs med=5.92ms max=37.89ms p(90)=9.98ms p(95)=11.21ms - http_reqs......................: 3605 15.004755/s - iteration_duration.............: avg=1s min=1s med=1s max=1.04s p(90)=1.01s p(95)=1.01s - iterations.....................: 3605 15.004755/s - vus............................: 1 min=1 max=20 - vus_max........................: 20 min=20 max=20 - - -running (4m00.3s), 00/20 VUs, 3605 complete and 0 interrupted iterations +execution: local + script: get_menu_item.js + output: - + scenarios: (100.00%) 1 scenario, 500 max VUs, 4m30s max duration (incl. graceful stop): + * default: Up to 500 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) -execution: local - script: create_menu_item.js + execution: local + script: get_menu_item.js output: - - scenarios: (100.00%) 1 scenario, 20 max VUs, 4m30s max duration (incl. graceful stop): - * default: Up to 20 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) + scenarios: (100.00%) 1 scenario, 150 max VUs, 7m30s max duration (incl. graceful stop): + * default: Up to 150 looping VUs for 7m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) - ✓ item creation status is 201 + ✗ status is 200 + ↳ 99% — ✓ 2596 / ✗ 1 + ✗ response time is < 1000ms + ↳ 99% — ✓ 2544 / ✗ 52 - checks.........................: 100.00% ✓ 3606 ✗ 0 - data_received..................: 1.6 MB 6.7 kB/s - data_sent......................: 970 kB 4.0 kB/s - http_req_blocked...............: avg=1.01ms min=157µs med=943µs max=6.29ms p(90)=1.71ms p(95)=1.84ms - http_req_connecting............: avg=926.53µs min=140µs med=865.49µs max=6.14ms p(90)=1.57ms p(95)=1.69ms - http_req_duration..............: avg=7.34ms min=1.14ms med=6.58ms max=71.14ms p(90)=12.5ms p(95)=15.62ms - { expected_response:true }...: avg=7.34ms min=1.14ms med=6.58ms max=71.14ms p(90)=12.5ms p(95)=15.62ms - http_req_failed................: 0.00% ✓ 0 ✗ 3606 - http_req_receiving.............: avg=94.92µs min=17µs med=57µs max=2.45ms p(90)=157µs p(95)=276.49µs - http_req_sending...............: avg=62.75µs min=9µs med=48µs max=4.09ms p(90)=109.5µs p(95)=132µs - http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...............: avg=7.19ms min=1.11ms med=6.41ms max=71.01ms p(90)=12.33ms p(95)=15.47ms - http_reqs......................: 3606 15.013595/s - iteration_duration.............: avg=1s min=1s med=1s max=1.07s p(90)=1.01s p(95)=1.01s - iterations.....................: 3606 15.013595/s - vus............................: 1 min=1 max=20 - vus_max........................: 20 min=20 max=20 + checks.........................: 98.98% ✓ 2596 ✗ 52 + data_received..................: 1.6 GB 3.8 MB/s + data_sent......................: 421 kB 998 B/s + http_req_blocked...............: avg=15.7ms min=2µs med=10µs max=1.24s p(90)=16µs p(95)=244.18ms + http_req_connecting............: avg=15.65ms min=0s med=0s max=1.24s p(90)=0s p(95)=244.05ms + http_req_duration..............: avg=12.37s min=854.84ms med=13.04s max=29.38s p(90)=20.71s p(95)=21.91s + { expected_response:true }...: avg=12.37s min=854.84ms med=13.04s max=29.38s p(90)=20.71s p(95)=21.91s + http_req_failed................: 0.03% ✓ 1 ✗ 2596 + http_req_receiving.............: avg=1.5s min=112µs med=1.34s max=8.35s p(90)=2.41s p(95)=2.88s + http_req_sending...............: avg=48.84µs min=13µs med=46µs max=574µs p(90)=66µs p(95)=89µs + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............: avg=10.87s min=316.34ms med=11.66s max=27.45s p(90)=19.3s p(95)=20.42s + http_reqs......................: 2597 6.160416/s + iteration_duration.............: avg=13.39s min=1.85s med=14.04s max=30.38s p(90)=21.74s p(95)=22.92s + iterations.....................: 2597 6.160416/s + vus............................: 1 min=1 max=150 + vus_max........................: 150 min=150 max=150 -running (4m00.2s), 00/20 VUs, 3606 complete and 0 interrupted iterations + running (7m01.6s), 000/150 VUs, 2597 complete and 0 interrupted iterations + default ✓ [======================================] 000/150 VUs 7m0s execution: local - script: get_menu_item.js - output: - - - scenarios: (100.00%) 1 scenario, 20 max VUs, 4m30s max duration (incl. graceful stop): - * default: Up to 20 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) - - - ✓ status is 200 - ✗ response time is < 500ms - ↳ 56% — ✓ 707 / ✗ 553 - - checks.........................: 78.05% ✓ 1967 ✗ 553 - data_received..................: 1.4 GB 6.0 MB/s - data_sent......................: 163 kB 677 B/s - http_req_blocked...............: avg=891.42µs min=252µs med=791µs max=8.16ms p(90)=1.08ms p(95)=1.42ms - http_req_connecting............: avg=845.17µs min=226µs med=752µs max=7.54ms p(90)=1.03ms p(95)=1.35ms - http_req_duration..............: avg=1.89s min=52.65ms med=101.24ms max=5.97s p(90)=4.74s p(95)=5.05s - { expected_response:true }...: avg=1.89s min=52.65ms med=101.24ms max=5.97s p(90)=4.74s p(95)=5.05s - http_req_failed................: 0.00% ✓ 0 ✗ 1260 - http_req_receiving.............: avg=1.08ms min=662µs med=962µs max=13.01ms p(90)=1.46ms p(95)=1.62ms - http_req_sending...............: avg=26.62µs min=11µs med=21µs max=360µs p(90)=35µs p(95)=52µs - http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...............: avg=1.89s min=51.92ms med=100.28ms max=5.97s p(90)=4.74s p(95)=5.05s - http_reqs......................: 1260 5.248719/s - iteration_duration.............: avg=2.9s min=1.05s med=1.1s max=6.98s p(90)=5.74s p(95)=6.05s - iterations.....................: 1260 5.248719/s - vus............................: 1 min=1 max=20 - vus_max........................: 20 min=20 max=20 - - -running (4m00.1s), 00/20 VUs, 1260 complete and 0 interrupted iterations + script: get_user_info.js + output: - + + scenarios: (100.00%) 1 scenario, 2000 max VUs, 4m30s max duration (incl. graceful stop): + * default: Up to 2000 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) + ✗ status is 200 + ↳ 91% — ✓ 64122 / ✗ 5929 + ✗ response time is < 1000ms + ↳ 52% — ✓ 37069 / ✗ 32982 + + checks.........................: 72.22% ✓ 101191 ✗ 38911 + data_received..................: 27 MB 111 kB/s + data_sent......................: 11 MB 45 kB/s + http_req_blocked...............: avg=7.82ms min=0s med=5µs max=528.84ms p(90)=9µs p(95)=12µs + http_req_connecting............: avg=7.81ms min=0s med=0s max=528.72ms p(90)=0s p(95)=0s + http_req_duration..............: avg=2.92s min=244.19ms med=890.73ms max=1m0s p(90)=9.55s p(95)=10.24s + { expected_response:true }...: avg=1.94s min=244.19ms med=820.54ms max=59.94s p(90)=3.97s p(95)=7.85s + http_req_failed................: 8.46% ✓ 5929 ✗ 64122 + http_req_receiving.............: avg=1.48ms min=0s med=191µs max=960.37ms p(90)=3.52ms p(95)=5.09ms + http_req_sending...............: avg=22.93µs min=3µs med=19µs max=6.95ms p(90)=30µs p(95)=43µs + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............: avg=2.92s min=244.12ms med=888.6ms max=1m0s p(90)=9.55s p(95)=10.24s + http_reqs......................: 70051 283.094222/s + iteration_duration.............: avg=3.93s min=1.24s med=1.9s max=1m1s p(90)=10.55s p(95)=11.24s + iterations.....................: 70047 283.078057/s + vus............................: 2 min=2 max=1999 + vus_max........................: 2000 min=2000 max=2000 + + +running (4m07.4s), 0000/2000 VUs, 70047 complete and 55 interrupted iterations +default ✓ [======================================] 0000/2000 VUs 4m0s execution: local - script: create_order.js - output: - - - scenarios: (100.00%) 1 scenario, 20 max VUs, 4m30s max duration (incl. graceful stop): - * default: Up to 20 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) - + script: sign_up_and_delete_user.js + output: - - ✓ order creation status is 201 - - checks.........................: 100.00% ✓ 3584 ✗ 0 - data_received..................: 4.6 MB 19 kB/s - data_sent......................: 910 kB 3.8 kB/s - http_req_blocked...............: avg=1.25ms min=187µs med=1.15ms max=19ms p(90)=2.1ms p(95)=2.23ms - http_req_connecting............: avg=1.15ms min=169µs med=1.06ms max=15.96ms p(90)=1.95ms p(95)=2.06ms - http_req_duration..............: avg=13.4ms min=2.22ms med=11.93ms max=79.63ms p(90)=22.95ms p(95)=28.98ms - { expected_response:true }...: avg=13.4ms min=2.22ms med=11.93ms max=79.63ms p(90)=22.95ms p(95)=28.98ms - http_req_failed................: 0.00% ✓ 0 ✗ 3584 - http_req_receiving.............: avg=150.97µs min=17µs med=78µs max=4.76ms p(90)=314.7µs p(95)=476.84µs - http_req_sending...............: avg=75.66µs min=9µs med=60µs max=8.56ms p(90)=124µs p(95)=150µs - http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...............: avg=13.17ms min=2.18ms med=11.65ms max=79.51ms p(90)=22.55ms p(95)=28.45ms - http_reqs......................: 3584 14.902651/s - iteration_duration.............: avg=1.01s min=1s med=1.01s max=1.08s p(90)=1.02s p(95)=1.03s - iterations.....................: 3584 14.902651/s - vus............................: 1 min=1 max=20 - vus_max........................: 20 min=20 max=20 - - -running (4m00.5s), 00/20 VUs, 3584 complete and 0 interrupted iterations \ No newline at end of file + scenarios: (100.00%) 1 scenario, 2000 max VUs, 4m30s max duration (incl. graceful stop): + * default: Up to 2000 looping VUs for 4m0s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s) \ No newline at end of file diff --git a/report/report.tex b/report/report.tex index 31433a0..91b8744 100644 --- a/report/report.tex +++ b/report/report.tex @@ -28,6 +28,8 @@ \section{Abstract} The original proposal can be found \href{https://csse6400.github.io/project-proposal-2024/s4780791/proposal.html}{here}. +\medskip \noindent The deployment url can be found in the root directory of the repo, in a file named url.txt. + \section{Changes} Describe and justify any changes made to the project from what was outlined in the proposal. @@ -384,7 +386,77 @@ \subsubsection*{Security} \medskip \noindent Brewbucks follows additional practices for secure software. Confidentiality design is followed, whereby masking is used for disclosure protection when a user enters their password. Dependency management is also followed. Lock files give the advantage of protecting against dependency injection. It was also intended for the system to log relevant operational information, such as events handled, packets processed and requests satisfied. This is useful for long term security purposes to diagnose breaches or attacks promptly. \section{Evaluation} -Summarise testing results and justify how well the software achieves its quality attributes. +A set of tests were created to evaluate delivery of the functionality and some quality attributes. All of the functionality tests were satisfied and met the proposal's requirements. This demonstrated a degree of support for quality attributes, for example security is supported by role-based access control working as expected. The k6 tests are the ones recommended in the original proposal. These can evaluate scalability, reliability and some availability. A list of the tests are attached below, with a brief summary. For the full testing results, see /k6\_test/result.txt in the root directory of the repo. + +\medskip \noindent \textbf{backend/brewbucks/tests/test\_views.py} +\begin{itemize} + \item test\_health() + \item test\_create\_user() + \item test\_get\_user\_information() + \item test\_update\_user\_info() + \item test\_delete\_sample\_user() + \item test\_delete\_non\_existing\_user() + \item test\_user\_login() + \item test\_create\_menu\_item() + \item test\_get\_menu\_items() + \item test\_update\_menu\_item() + \item test\_delete\_menu\_item() + \item test\_create\_order\_success() + \item test\_create\_order\_invalid\_user() + \item test\_get\_order\_items() + \item test\_update\_order\_item() + \item test\_delete\_order\_item() + \item test\_get\_active\_orders() + \item test\_get\_finished\_orders() + \item test\_get\_making\_orders() + \item test\_get\_making\_orders\_all() + \item test\_create\_and\_get\_rewards() +\end{itemize} + +\medskip \noindent \textbf{/k6 tests} +create\_menu\_item.js +\begin{itemize} + \item Test creating an item in the menu + \item stages: [ + { duration: '1m', target: 500 }, + { duration: '2m', target: 1000 }, + { duration: '1m', target: 0 }, + ], + \item Ensure the status code is 201 + \item FAIL item creation status is 201 + \item 99\% — PASS 2884 / FAIL 20 +\end{itemize} + +\medskip \noindent create\_order.js +\begin{itemize} + \item Test creating an order containing 2 items, with quantities of 2 and 1. + \item stages: [ + { duration: '2m', target: 1000 }, // Ramp-up to 20 users over 1 minute + { duration: '2m', target: 2500 }, // Stay at 20 users for 2 minutes + { duration: '2m', target: 0 }, // Ramp-down to 0 users over 1 minute + ], + \item Ensure order creation status is 201 + \item FAIL order creation status is 201 + \item 78\% — PASS 47888 / FAIL 13139 +\end{itemize} + +\medskip \noindent get\_menu\_item.js +\begin{itemize} + \item Test getting all of the menu items + \item stages: [ + { duration: '1m', target: 45 }, + { duration: '2m', target: 75 }, + { duration: '1m', target: 0 }, + ], + \item Ensure status code is 200 + \item Ensure response time is < 750ms + \item FAIL status is 200 99\% — PASS 2596 / FAIL 1 + \item FAIL response time is < 1000ms 99\% — PASS 2544 / FAIL 52 +\end{itemize} + +\medskip \noindent The k6 tests demonstrate scalability, availability and reliability. There were results that suggested the need for improvements to the system, to better handle bottlenecks, this includes get\_menu\_items. For the most part, the results satisfy at a scale, varying loads put on different features. The system does well against large scale ordeer creation, getting user details and create\_menu\_item. This would mean that throughout day to day operations, the system satisfies the scalability and reliability quality attributes. Ideally, future tests should use automated monitoring tools like Nagios or Prometheus, to have complete quality assurance for availability. However, for the MVP stages, the performance of various features proved to be reliable. Note the full set of tests are in /k6\_test + + \section{Reflection} \subsubsection*{General Reflections on Project}