-
Notifications
You must be signed in to change notification settings - Fork 0
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
12b883c
commit 32fa3a2
Showing
4 changed files
with
71 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,42 @@ | ||
name: Performance Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
name: Performance Tests | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: bitnami/postgresql | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRESQL_USERNAME: postgres | ||
POSTGRESQL_PASSWORD: postgres | ||
POSTGRESQL_DATABASE: modular-pets | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: 1.1.38 | ||
|
||
- name: Install Dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Install K6 | ||
run: sudo apt-get update && sudo apt-get install -y k6 | ||
|
||
- name: Run Performance Tests | ||
run: bun run ci:test:performance | ||
env: | ||
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/modular-pets" |
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
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,26 @@ | ||
import http from "k6/http"; | ||
|
||
export const options = { | ||
stages: [ | ||
{ duration: "30s", target: 20 }, | ||
{ duration: "1m", target: 60 }, | ||
{ duration: "30s", target: 0 }, | ||
], | ||
thresholds: { | ||
http_req_duration: ["avg<100", "p(95)<200"], | ||
http_reqs: ["rate>2000"], | ||
}, | ||
noConnectionReuse: true, | ||
}; | ||
|
||
export default function () { | ||
const data = { | ||
name: "Dog", | ||
}; | ||
|
||
// basic POST request (first 201 created, then 409 conflict) | ||
|
||
http.post("http://localhost:3333/species", JSON.stringify(data), { | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
} |