-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/performance-test' of https://github.com/DFE-Dig…
…ital/academies-api into feature/performance-test
- Loading branch information
Showing
2 changed files
with
126 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,47 @@ | ||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
|
||
export const options = { | ||
vus: 800, | ||
duration: '30s', | ||
// httpDebug: 'full', | ||
}; | ||
|
||
const baseUrl = "https://localhost:5001/v4"; | ||
|
||
export default function () { | ||
getEstablishmentsForTrust("UKPRN37cda865-dbe0-426f-9485-84c1cf3d8513"); | ||
|
||
getEstablishmentByUkPrn("UKPRN0b2ecaa7-4ec3-4138-805b-3d7d904962a4"); | ||
|
||
sleep(1); | ||
} | ||
|
||
function getEstablishmentsForTrust(ukprn) { | ||
const res = http.get(`${baseUrl}/establishments/trust?trustUkPrn=${ukprn}`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function getEstablishmentByUkPrn(ukprn) { | ||
const res = http.get(`${baseUrl}/establishment/${ukprn}`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function isStatus200(res) { | ||
check(res, { | ||
'status is 200': (r) => r.status === 200, | ||
}); | ||
} | ||
|
||
function getHeaders() { | ||
return { | ||
"ApiKey": "app-key", | ||
"Content-Type": "application/json" | ||
}; | ||
} |
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,79 @@ | ||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
|
||
export const options = { | ||
vus: 400, | ||
duration: '30s', | ||
// httpDebug: 'full', | ||
}; | ||
|
||
const baseUrl = "https://localhost:5001/v4"; | ||
|
||
export default function () { | ||
|
||
searchTrustByName("Name91b71279-6799-4f2c-843d-8e6b35ae7ffa"); | ||
|
||
getTrustByUkPrn("UKPRN692c06a7-089a-46be-ae3b-e4d6fee8126e"); | ||
|
||
searchTrustByUkPrn("UKPRN692c06a7-089a-46be-ae3b-e4d6fee8126e"); | ||
|
||
getTrustByCompaniesHouseNumber("CompaniesHouseNumbercfa7f419-f27e-4f6c-9266-9a9c560ae6a3"); | ||
|
||
getTrustByReferenceNumber("GroupID97be1318-42e1-4527-a75e-595ba4768153"); | ||
|
||
sleep(1); | ||
} | ||
|
||
function searchTrustByName(name) { | ||
const res = http.get(`${baseUrl}/trusts?groupName=${name}&page=1&count=10`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function searchTrustByUkPrn(ukprn) { | ||
const res = http.get(`${baseUrl}/trusts?ukPrn=${ukprn}&page=1&count=10`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function getTrustByUkPrn(ukprn) { | ||
const res = http.get(`${baseUrl}/trust/${ukprn}`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function getTrustByCompaniesHouseNumber(companiesHouseNumber) { | ||
const res = http.get(`${baseUrl}/trust/companiesHouseNumber/${companiesHouseNumber}`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
|
||
} | ||
|
||
function getTrustByReferenceNumber(trustReferenceNumber) { | ||
const res = http.get(`${baseUrl}/trust/trustReferenceNumber/${trustReferenceNumber}`, { | ||
headers: getHeaders() | ||
}); | ||
|
||
isStatus200(res); | ||
} | ||
|
||
function isStatus200(res) { | ||
check(res, { | ||
'status is 200': (r) => r.status === 200, | ||
}); | ||
} | ||
|
||
function getHeaders() { | ||
return { | ||
"ApiKey": "app-key", | ||
"Content-Type": "application/json" | ||
}; | ||
} |