-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Load Tests run in CI #324
Conversation
2e1e1ba
to
a9b3da4
Compare
Run the tests Everything has tests now WIP WIP 2 Trying a different way to run the k6 tests
Give a bit more time before starting Fix health check urls Fix issue with GHA script Move just to node More documentation on the wait for ready check Javascript :( Change wait method Fix endpoint
Add the rust webhook server to the docker compose for k6 account service
e8f6973
to
bf36d15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This follows the pattern from the Unit test workflow
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why node?
Because we need to run the setup script npm run main
in tools/ci-k6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each service has a docker-compose-k6.{service}.yaml. This overrides the base docker-compose
.
- Switches to use the production docker
- configures other services and conditions as needed.
PROVIDER_BASE_URL: 'http://account-service-webhook:3001/webhooks/account-service' | ||
WEBHOOK_BASE_URL: 'http://account-service-webhook:3001/webhooks' | ||
|
||
account-service-webhook: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great example of an additional service needed.
profiles: | ||
- skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so these services don't start by default. Easiest way to do this I found
@@ -55,7 +56,7 @@ services: | |||
- redis_data:/data/redis | |||
|
|||
frequency: | |||
image: dsnp/instant-seal-node-with-deployed-schemas:latest | |||
image: frequencychain/standalone-node:v1.13.0-rc3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going ahead and switching to the new base image
@@ -159,7 +160,6 @@ services: | |||
- graph_node_cache:/app/services/graph/node_modules | |||
depends_on: | |||
- redis | |||
- ipfs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
graph service doesn't need ipfs
@@ -10,7 +10,7 @@ | |||
<mxCell id="34" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> | |||
<mxGeometry x="280" y="330" width="390" height="330" as="geometry" /> | |||
</mxCell> | |||
<mxCell id="35" value="GET/api/health" style="endArrow=classic;html=1;rounded=0;fillColor=#d5e8d4;strokeColor=#82b366;strokeWidth=3;exitX=0.996;exitY=0.17;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.172;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="45" target="41" edge="1"> | |||
<mxCell id="35" value="GET/healthz" style="endArrow=classic;html=1;rounded=0;fillColor=#d5e8d4;strokeColor=#82b366;strokeWidth=3;exitX=0.996;exitY=0.17;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.172;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="45" target="41" edge="1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the correct one, but I didn't generate the pngs for it. Let me know if it is correct.
@@ -1,7 +1,7 @@ | |||
# Generated k6 script | |||
|
|||
The `account-service-load.js` file contains most of the Swagger/OpenAPI specification and you can customize it to your needs. | |||
The `health-check.js` file contains a simple health check script that can be used to check the health of the service. | |||
The `account-service-load.k6.js` file contains most of the Swagger/OpenAPI specification and you can customize it to your needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First place this shows up...
So why?
- I needed to be able to know when something was specifically for k6
- This felt easier than trying to put all non-k6 test files into a subdirectory
``` | ||
|
||
## Generating Test Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a script to generate the information needed to run this test. I went for committing the generated code, as it works fine for running in CI and most runs. I'd be open to generating this as needed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file I needed to move to skip as it requires more setup than we currently have in place. Various options to do this setup (including generating data like we do for signup) to using the same setup script that creates the provider.
@@ -36,63 +36,7 @@ const SLEEP_DURATION = 0.1; | |||
// Global variables should be initialized. | |||
|
|||
export default function () { | |||
group('health', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Health and siwf signup are in other test files now.
} | ||
}); | ||
|
||
// Needs 255 generated accounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotated these with what they need to get it unskipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generator script
@@ -43,38 +46,39 @@ const CALLBACK_URL = 'http://localhost:3001/webhooks/account-service'; | |||
const BASE_URL = 'http://localhost:3000'; | |||
// Sleep duration between successive requests. | |||
const SLEEP_DURATION = 0.1; | |||
const BLOCKTIME_SECONDS = 12; | |||
const BLOCKTIME_SECONDS = 13; // Add 1 second for additional loop buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there is a better way to do this, but it works consistently.
@@ -22,7 +22,7 @@ const WEBHOOK_ENDPOINT: &str = "/account-service"; | |||
|
|||
#[actix_web::main] | |||
async fn main() -> Result<(), impl Error> { | |||
const HOST: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1); | |||
const HOST: Ipv4Addr = Ipv4Addr::new(0, 0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows this to bind to the external interface in docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the basic health check to the content watcher so everything has k6 tests
tools/ci-k6/main.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the chain setup script
ipfs: | ||
condition: service_healthy | ||
account-service-webhook: | ||
condition: service_healthy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, didn't know you could have conditions on dependencies.
console.log('Block finalized. Checking callback...'); | ||
checkCallback(); | ||
console.log('Block finalized. Checking callback...', { referenceId }); | ||
checkCallback(referenceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, love this improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
Problem
We want to run the k6 tests in CI so that they also function as semi-integration test system.
Closes: #317
Solution
account-service-load.k6.js
#344