-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds docs from avaliability tests to the repo
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# UniBasement-Avaliability-Tests | ||
Seperate Repo to keep my pi nice and smol :) | ||
|
||
## Overview | ||
A cron job was setup on a raspberry pi to run `script/script.sh` every 5 minutes. | ||
|
||
The k6 test: | ||
* sends a `GET` request to the UniBasement frontend homepage to verify the user facing site is accessible | ||
* sends a `GET` request to the UniBasement backend courses route and checks the response body to verify the backend and database are both running | ||
|
||
|
||
## Results | ||
The test was running for 2 days, with only a 15 minute downtime at midnight on the 28th May. This means the uptime was 99.5%, which exceeds the required 99% uptime in the proposal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
k6 run ./test.js | grep -Poz '(?s)(?<=---).*?(?=---)' >> log.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { check, sleep } from "k6"; | ||
import http from "k6/http"; | ||
|
||
export const options = { | ||
duration: '10s' | ||
}; | ||
|
||
const frontendUrl = 'http://unibasement.g6.csse6400.xyz/' | ||
const backendUrl = 'http://unibasementBackend-2061383905.us-east-1.elb.amazonaws.com:8080/api/' | ||
|
||
export default function () { | ||
let res = http.get(frontendUrl); | ||
check(res, { | ||
"frontend status was 200": (r) => r.status === 200, | ||
}); | ||
|
||
res = http.get(backendUrl + 'courses'); | ||
check(res, { | ||
"backend status was 200": (r) => r.status === 200, | ||
"backend body contains list of courses": (r) => r.json().length > 0 && !!r.json()[0].courseCode, | ||
}); | ||
|
||
sleep(0.1); | ||
} | ||
|
||
export function handleSummary(output) { | ||
const formatted = output.root_group.checks.map((c) => `'${c.name}': ${c.passes}/${c.passes + c.fails}`) | ||
return { stdout: `---\n[${new Date()}]\n` + formatted.join('\n') + '\n---\n' } | ||
} |