-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a5feb1
commit fd69578
Showing
9 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "ffc-grants-eligibility-checker", | ||
"description": "FFC Grant Eligibility Checker", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"license": "OGL-UK-3.0", | ||
"contributors": [ | ||
"Andrew Folga <[email protected]>", | ||
|
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,6 @@ | ||
node_modules | ||
.dockerignore | ||
.env | ||
docker-compose* | ||
Dockerfile | ||
README.md |
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,4 @@ | ||
FROM grafana/k6 | ||
COPY script.js /script.js | ||
USER k6 | ||
CMD ["run", "/script.js"] |
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,19 @@ | ||
# Performance Tests | ||
This folder contains the performance tests for the Grants Eligibility Checker app. The framework used is Grafana k6. | ||
|
||
## Set up | ||
k6 can be installed and run locally on the machine, or a docker container with k6 is available. See https://grafana.com/docs/k6/latest/set-up/install-k6/. | ||
|
||
k6 does not use NodeJS but _npm install_ can be used to install the _@types/k6_ package to give intellisense in VS Code. | ||
|
||
## Running tests in a container | ||
```pwsh | ||
# TEST_ENVIRONMENT_ROOT_URL environment variable must be set, and can be provided via local .env file | ||
docker-compose run --build --rm perf-test | ||
``` | ||
|
||
## Running tests against a local k6 installation | ||
```pwsh | ||
# TEST_ENVIRONMENT_ROOT_URL environment variable must be set, or can be provided on command line | ||
k6 run -e TEST_ENVIRONMENT_ROOT_URL=http://localhost:3000 script.js | ||
``` |
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,6 @@ | ||
services: | ||
perf-test: | ||
build: . | ||
image: perf-test | ||
environment: | ||
TEST_ENVIRONMENT_ROOT_URL: ${TEST_ENVIRONMENT_ROOT_URL} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
{ | ||
"name": "performance", | ||
"version": "1.0.0", | ||
"main": "script.js", | ||
"scripts": { | ||
"test": "k6 run -e TEST_ENVIRONMENT_ROOT_URL=http://localhost:3000 script.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "Grants Eligibility Checker Performance Tests", | ||
"devDependencies": { | ||
"@types/k6": "^0.54.0" | ||
} | ||
} |
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,37 @@ | ||
/* global __ENV */ | ||
import http from 'k6/http'; | ||
import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js'; | ||
|
||
export const options = { | ||
scenarios: { | ||
journey: { | ||
executor: 'ramping-vus', | ||
startVUs: 0, | ||
stages: [ | ||
{ duration: '5s', target: 50 }, | ||
{ duration: '25s', target: 50 } | ||
], | ||
gracefulRampDown: '0s', | ||
gracefulStop: '5s' | ||
} | ||
}, | ||
thresholds: { | ||
http_req_duration: ['p(99)<250'] // 99% of requests should be below 250ms | ||
} | ||
}; | ||
|
||
/** | ||
* Performs the checker journey. | ||
* This default function is called for every iteration run by k6. | ||
*/ | ||
export default function () { | ||
describe('Checker Journey', (t) => { | ||
const response = http.get( | ||
`${__ENV.TEST_ENVIRONMENT_ROOT_URL}/eligibility-checker/example-grant/start` | ||
); | ||
expect(response.status).to.equal(200); | ||
|
||
const heading = response.html().find('h1').text(); | ||
expect(heading).to.equal('Generic checker screens'); | ||
}); | ||
} |