diff --git a/Dfe.Academies.Performance/scripts/v1/keyStagePerformance.js b/Dfe.Academies.Performance/scripts/v1/keyStagePerformance.js new file mode 100644 index 000000000..f07d76210 --- /dev/null +++ b/Dfe.Academies.Performance/scripts/v1/keyStagePerformance.js @@ -0,0 +1,37 @@ +import http from 'k6/http' +import { check, sleep } from 'k6' + +export const options = { + vus: 20, + duration: '30s' +} + +const baseUrl = 'https://localhost:5001' + +export default function () { + + getEducationPerformanceByUrn('100000') + + sleep(1) +} + +function getEducationPerformanceByUrn(urn) { + const res = http.get(`${baseUrl}/educationPerformance/${urn}`, { + 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' + } +} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v2/baselineTracker.js b/Dfe.Academies.Performance/scripts/v2/baselineTracker.js new file mode 100644 index 000000000..05ac60895 --- /dev/null +++ b/Dfe.Academies.Performance/scripts/v2/baselineTracker.js @@ -0,0 +1,38 @@ +import http from 'k6/http' +import { check, sleep } from 'k6' + +export const options = { + vus: 20, + duration: '30s' +} + +const baseUrl = 'https://localhost:5001/v2' + +export default function () { + + getBaselineTrackers() + + sleep(1) +} + +function getBaselineTrackers() { + // TODO change url endpoint when spelling mistake resolved + const res = http.get(`${baseUrl}/basline-tracker?page=1&count=50`, { + 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' + } +} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v2/fssProjects.js b/Dfe.Academies.Performance/scripts/v2/fssProjects.js new file mode 100644 index 000000000..2ebacb26f --- /dev/null +++ b/Dfe.Academies.Performance/scripts/v2/fssProjects.js @@ -0,0 +1,37 @@ +import http from 'k6/http' +import { check, sleep } from 'k6' + +export const options = { + vus: 20, + duration: '30s' +} + +const baseUrl = 'https://localhost:5001/v2' + +export default function () { + + getFreeSchoolProjects() + + sleep(1) +} + +function getFreeSchoolProjects() { + const res = http.get(`${baseUrl}/fss/projects`, { + 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' + } +} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v3/trusts.js b/Dfe.Academies.Performance/scripts/v3/trusts.js new file mode 100644 index 000000000..ba281df8f --- /dev/null +++ b/Dfe.Academies.Performance/scripts/v3/trusts.js @@ -0,0 +1,57 @@ +import http from 'k6/http' +import { check, sleep } from 'k6' + +export const options = { + vus: 20, + duration: '30s' +} + +const baseUrl = 'https://localhost:5001/v3' + +export default function () { + + getTrustByUkPrn('10067112') + + searchTrustByName('SOUTH YORK MULTI ACADEMY TRUST') + + searchTrustByUkPrn('10067112') + + sleep(1) +} + +function getTrustByUkPrn(ukprn) { + const res = http.get(`${baseUrl}/trust/${ukprn}`, { + headers: getHeaders() + }) + + isStatus200(res) +} + +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 isStatus200(res) { + check(res, { + 'status is 200': (r) => r.status === 200, + }) +} + +function getHeaders() { + return { + 'ApiKey': 'app-key', + 'Content-Type': 'application/json' + } +} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v4/establishments.js b/Dfe.Academies.Performance/scripts/v4/establishments.js new file mode 100644 index 000000000..23b887309 --- /dev/null +++ b/Dfe.Academies.Performance/scripts/v4/establishments.js @@ -0,0 +1,58 @@ +import http from 'k6/http' +import { check, sleep } from 'k6' + +export const options = { + vus: 20, + duration: '30s', + // httpDebug: 'full', +} + +const baseUrl = 'https://localhost:5001/v4' + +export default function () { + + getEstablishmentByUkPrn('10079319') + + getEstablishmentByUrn('100000') + + getEstablishmentsForTrust('10067112') + + sleep(1) +} + +function getEstablishmentByUkPrn(ukprn) { + const res = http.get(`${baseUrl}/establishment/${ukprn}`, { + headers: getHeaders() + }) + + isStatus200(res) +} + +function getEstablishmentByUrn(urn) { + const res = http.get(`${baseUrl}/establishment/urn/${urn}`, { + headers: getHeaders() + }) + + isStatus200(res) +} + +function getEstablishmentsForTrust(ukprn) { + const res = http.get(`${baseUrl}/establishments/trust?trustUkPrn=${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' + } +} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v4/get-establishment.js b/Dfe.Academies.Performance/scripts/v4/get-establishment.js deleted file mode 100644 index 2f8406a18..000000000 --- a/Dfe.Academies.Performance/scripts/v4/get-establishment.js +++ /dev/null @@ -1,47 +0,0 @@ -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" - }; -} \ No newline at end of file diff --git a/Dfe.Academies.Performance/scripts/v4/get-trust.js b/Dfe.Academies.Performance/scripts/v4/trusts.js similarity index 59% rename from Dfe.Academies.Performance/scripts/v4/get-trust.js rename to Dfe.Academies.Performance/scripts/v4/trusts.js index fce8f0322..726aeea80 100644 --- a/Dfe.Academies.Performance/scripts/v4/get-trust.js +++ b/Dfe.Academies.Performance/scripts/v4/trusts.js @@ -1,79 +1,79 @@ -import http from 'k6/http'; -import { check, sleep } from 'k6'; +import http from 'k6/http' +import { check, sleep } from 'k6' export const options = { - vus: 400, + vus: 20, duration: '30s', // httpDebug: 'full', -}; +} -const baseUrl = "https://localhost:5001/v4"; +const baseUrl = 'https://localhost:5001/v4' export default function () { - searchTrustByName("Name91b71279-6799-4f2c-843d-8e6b35ae7ffa"); - - getTrustByUkPrn("UKPRN692c06a7-089a-46be-ae3b-e4d6fee8126e"); + getTrustByUkPrn('10067112') - searchTrustByUkPrn("UKPRN692c06a7-089a-46be-ae3b-e4d6fee8126e"); + getTrustByCompaniesHouseNumber('11082297') - getTrustByCompaniesHouseNumber("CompaniesHouseNumbercfa7f419-f27e-4f6c-9266-9a9c560ae6a3"); + getTrustByReferenceNumber('TR03739') + + searchTrustByUkPrn('10067112') - getTrustByReferenceNumber("GroupID97be1318-42e1-4527-a75e-595ba4768153"); + searchTrustByName('SOUTH YORK MULTI ACADEMY TRUST') - sleep(1); + sleep(1) } -function searchTrustByName(name) { - const res = http.get(`${baseUrl}/trusts?groupName=${name}&page=1&count=10`, { +function getTrustByUkPrn(ukprn) { + const res = http.get(`${baseUrl}/trust/${ukprn}`, { headers: getHeaders() - }); + }) - isStatus200(res); + isStatus200(res) } -function searchTrustByUkPrn(ukprn) { - const res = http.get(`${baseUrl}/trusts?ukPrn=${ukprn}&page=1&count=10`, { +function getTrustByCompaniesHouseNumber(companiesHouseNumber) { + const res = http.get(`${baseUrl}/trust/companiesHouseNumber/${companiesHouseNumber}`, { headers: getHeaders() - }); + }) + + isStatus200(res) - isStatus200(res); } -function getTrustByUkPrn(ukprn) { - const res = http.get(`${baseUrl}/trust/${ukprn}`, { +function getTrustByReferenceNumber(trustReferenceNumber) { + const res = http.get(`${baseUrl}/trust/trustReferenceNumber/${trustReferenceNumber}`, { headers: getHeaders() - }); + }) - isStatus200(res); + isStatus200(res) } -function getTrustByCompaniesHouseNumber(companiesHouseNumber) { - const res = http.get(`${baseUrl}/trust/companiesHouseNumber/${companiesHouseNumber}`, { +function searchTrustByName(name) { + const res = http.get(`${baseUrl}/trusts?groupName=${name}&page=1&count=10`, { headers: getHeaders() - }); + }) isStatus200(res); - } -function getTrustByReferenceNumber(trustReferenceNumber) { - const res = http.get(`${baseUrl}/trust/trustReferenceNumber/${trustReferenceNumber}`, { +function searchTrustByUkPrn(ukprn) { + const res = http.get(`${baseUrl}/trusts?ukPrn=${ukprn}&page=1&count=10`, { headers: getHeaders() - }); + }) - isStatus200(res); + isStatus200(res) } function isStatus200(res) { check(res, { 'status is 200': (r) => r.status === 200, - }); + }) } function getHeaders() { return { - "ApiKey": "app-key", - "Content-Type": "application/json" - }; + 'ApiKey': 'app-key', + 'Content-Type': 'application/json' + } } \ No newline at end of file