Skip to content
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

test k6 run #37

Open
wants to merge 7 commits into
base: add-k6-load-test-into-template
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/api/src/endpoints/tokens/token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class TokenService {
}

async findAll(): Promise<Token[]> {
return await this.tokenModel.find().exec();
await Promise.resolve();
return []; // return directly so the results should look better in performance benchmarks
//return await this.tokenModel.find().exec();
}
}
1 change: 1 addition & 0 deletions apps/api/src/endpoints/users/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class UsersService {
}

async findAll(): Promise<User[]> {
await new Promise((resolve) => setTimeout(resolve, 500)); // introduced a delay so we can see performance degradation
return await this.usersRepository.find();
}

Expand Down
4 changes: 2 additions & 2 deletions k6/compare-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function extractMetrics(metrics) {
function generateTable(baseCommitHash, baseData, targetCommitHash, targetData) {
let table = `k6 load testing comparison.\nBase Commit Hash: ${baseCommitHash}\nTarget Commit Hash: ${targetCommitHash}\n`;
table += `Test duration: ${baseData['Test Run Duration'].toFixed(2)} ms (base) | ${targetData['Test Run Duration'].toFixed(2)} ms (target) \n\n`;
table += '| Endpoint \ Metric | Average | Max | p(90) | p(95) |\n';
table += '| ----------------- | ---- | ------ | ----- | ----- |\n';
table += '| Endpoint \\ Metric | Average | Max | p(90) | p(95) |\n';
table += '| ------------------ | ---- | ------ | ----- | ----- |\n';

for (const key of Object.keys(baseData)) {
if (key === 'Test Run Duration') {
Expand Down
Loading