mirror of https://github.com/rancher/dartboard.git
update naming for data size tracking function, update retry function signatures (#85)
This commit is contained in:
parent
c09c1e11a1
commit
fe86eb53a9
|
|
@ -3,6 +3,7 @@ import http from 'k6/http'
|
|||
import { retryUntilExpected } from "../rancher/rancher_utils.js";
|
||||
import * as YAML from '../lib/js-yaml-4.1.0.mjs'
|
||||
|
||||
|
||||
export const baseCRDPath = "v1/apiextensions.k8s.io.customresourcedefinitions"
|
||||
export const crdTag = { url: `/v1/apiextensions.k8s.io.customresourcedefinitions/<CRD ID>` }
|
||||
export const crdsTag = { url: `/v1/apiextensions.k8s.io.customresourcedefinitions` }
|
||||
|
|
@ -27,20 +28,6 @@ export function cleanupMatchingCRDs(baseUrl, cookies, namePrefix) {
|
|||
})
|
||||
}
|
||||
|
||||
export function sizeOfHeaders(hdrs) {
|
||||
return Object.keys(hdrs).reduce((sum, key) => sum + key.length + hdrs[key].length, 0);
|
||||
}
|
||||
|
||||
export function trackDataMetricsPerURL(res, tags, headerDataRecv, epDataRecv) {
|
||||
// Add data points for received data
|
||||
headerDataRecv.add(sizeOfHeaders(res.headers));
|
||||
if (res.hasOwnProperty('body') && res.body) {
|
||||
epDataRecv.add(res.body.length, tags);
|
||||
} else {
|
||||
epDataRecv.add(0, tags)
|
||||
}
|
||||
}
|
||||
|
||||
export function getCRD(baseUrl, cookies, id) {
|
||||
let res = http.get(`${baseUrl}/${baseCRDPath}/${id}`, { cookies: cookies, tag: crdTag })
|
||||
let criteria = []
|
||||
|
|
@ -66,7 +53,7 @@ export function verifyCRDs(baseUrl, cookies, namePrefix, expectedLength, timeout
|
|||
let currentLength = -1
|
||||
// Poll customresourcedefinitions until receiving a 200
|
||||
while (new Date() - timeWas < timeoutMs) {
|
||||
res = retryUntilExpected(200, () => { return getCRDs(baseUrl, cookies) })
|
||||
res = retryUntilExpected(200, 9, () => { return getCRDs(baseUrl, cookies) })
|
||||
timeSpent = new Date() - timeWas
|
||||
if (res.status === 200) {
|
||||
let data = JSON.parse(res.body)["data"]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { getCookies, login } from "../rancher/rancher_utils.js";
|
|||
import exec from "k6/execution";
|
||||
import { randomString } from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 20
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -71,7 +71,7 @@ export function createCRDs(cookies) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${exec.vu.idInTest}-${randomString(4)}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.5)
|
||||
}
|
||||
sleep(0.15)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Trend } from 'k6/metrics';
|
|||
import { getCookies, login } from "../rancher/rancher_utils.js";
|
||||
import { vu as metaVU } from 'k6/execution'
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 20
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -86,7 +86,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
}
|
||||
let { res, crdArray: crds } = crdUtil.getCRDsMatchingName(baseUrl, cookies, namePrefix)
|
||||
|
|
@ -103,7 +103,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
export function deleteCRDs(data) {
|
||||
data.crdArray.forEach(c => {
|
||||
let res = crdUtil.deleteCRD(baseUrl, data.cookies, c.id)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.15)
|
||||
})
|
||||
let { _, timeSpent } = crdUtil.verifyCRDs(baseUrl, data.cookies, namePrefix, 0, crdUtil.crdRefreshDelayMs * 5)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { Trend } from 'k6/metrics';
|
|||
import { getCookies, login } from "../rancher/rancher_utils.js";
|
||||
import * as k8s from '../generic/k8s.js'
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 20
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -68,7 +68,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
}
|
||||
let { res, crdArray } = crdUtil.getCRDsMatchingName(baseUrl, cookies, namePrefix)
|
||||
|
|
@ -82,6 +82,6 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
|
||||
export function getCRDs(data) {
|
||||
let res = crdUtil.getCRDs(baseUrl, data.cookies)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Trend } from 'k6/metrics';
|
|||
import { getCookies, login } from "../rancher/rancher_utils.js";
|
||||
import { vu as metaVU } from 'k6/execution'
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 1
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -116,7 +116,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`;
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix);
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv);
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv);
|
||||
sleep(0.25);
|
||||
}
|
||||
sleep(0.15);
|
||||
|
|
@ -142,7 +142,7 @@ export function loadCRDs(data) {
|
|||
}
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, c.id);
|
||||
let modifyCRD = JSON.parse(res.body);
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv);
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv);
|
||||
|
||||
modifyCRD.spec.versions[1].storage = false;
|
||||
modifyCRD.spec.versions[2] = newSchema;
|
||||
|
|
@ -150,7 +150,7 @@ export function loadCRDs(data) {
|
|||
fail("CRD DOES NOT HAVE EXPECTED # OF VERSIONS (3)");
|
||||
}
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD);
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv);
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv);
|
||||
})
|
||||
let { res, timeSpent } = crdUtil.verifyCRDs(baseUrl, data.cookies, namePrefix, crdCount, crdUtil.crdRefreshDelayMs * 5);
|
||||
console.log("VERIFY STATUS: ", res.status);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Trend } from 'k6/metrics';
|
|||
import { getCookies, login } from "../rancher/rancher_utils.js";
|
||||
import { vu as metaVU } from 'k6/execution'
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 20
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -117,7 +117,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
}
|
||||
let { res, crdArray: crds } = crdUtil.getCRDsMatchingName(baseUrl, cookies, namePrefix)
|
||||
|
|
@ -139,7 +139,7 @@ export function updateCRDs(data) {
|
|||
}
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, c.id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
|
||||
modifyCRD.spec.versions[1].storage = false
|
||||
modifyCRD.spec.versions[2] = newSchema
|
||||
|
|
@ -147,7 +147,7 @@ export function updateCRDs(data) {
|
|||
fail("CRD DOES NOT HAVE EXPECTED # OF VERSIONS (3)")
|
||||
}
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
})
|
||||
let { res, timeSpent } = crdUtil.verifyCRDs(baseUrl, data.cookies, namePrefix, crdCount, crdUtil.crdRefreshDelayMs * 5)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { getCookies, login } from "../rancher/rancher_utils.js";
|
|||
import { vu as metaVU } from 'k6/execution'
|
||||
import * as crdUtil from "./crd_utils.js";
|
||||
import * as k8s from '../generic/k8s.js'
|
||||
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 20
|
||||
const crdCount = __ENV.CRD_COUNT || 500
|
||||
|
|
@ -120,7 +120,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
}
|
||||
let { res: res, crdArray: crds } = crdUtil.getCRDsMatchingName(baseUrl, cookies, namePrefix)
|
||||
|
|
@ -141,7 +141,7 @@ export function updateCRDs(data) {
|
|||
}
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, c.id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
|
||||
modifyCRD.spec.versions[2] = newSchema
|
||||
// Unset previously stored version
|
||||
|
|
@ -151,7 +151,7 @@ export function updateCRDs(data) {
|
|||
}
|
||||
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
})
|
||||
sleep(0.15)
|
||||
|
|
@ -175,7 +175,7 @@ function updateStorageVersion(data, updatedIDs) {
|
|||
updatedIDs.forEach(id => {
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
// Unset previously stored version
|
||||
if (modifyCRD && 'spec' in modifyCRD && 'versions' in modifyCRD) {
|
||||
modifyCRD.spec.versions[1].storage = false
|
||||
|
|
@ -203,7 +203,7 @@ function destructiveUpdate(data, updatedIDs) {
|
|||
updatedIDs.forEach(id => {
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
// Unset newly added stored version
|
||||
modifyCRD.spec.versions[2].storage = false
|
||||
modifyCRD.spec.versions[2].served = false
|
||||
|
|
@ -211,7 +211,7 @@ function destructiveUpdate(data, updatedIDs) {
|
|||
modifyCRD.spec.versions[1].served = true
|
||||
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
})
|
||||
let { res: res, timeSpent: _ } = crdUtil.getCRDsMatchingName(baseUrl, data.cookies, namePrefix)
|
||||
|
|
@ -245,10 +245,10 @@ function destructiveUpdate(data, updatedIDs) {
|
|||
let k8sRes = k8s.patch(`${baseUrl}/apis/apiextensions.k8s.io/v1/customresourcedefinitions/${r.id}/status`, storedVersions, patchParams)
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, r.id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
modifyCRD.spec.versions.splice(2, 1)
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
});
|
||||
({ res: verifyRes, timeSpent: timeSpent } = crdUtil.verifyCRDs(baseUrl, data.cookies, namePrefix, crdCount, crdUtil.crdRefreshDelayMs * 5))
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {check, fail, sleep} from 'k6';
|
|||
import exec from 'k6/execution';
|
||||
import http from 'k6/http';
|
||||
import {Gauge} from 'k6/metrics';
|
||||
import * as projectUtil from "../projects/project_utils.js";
|
||||
import {getCookies, login} from "../rancher/rancher_utils.js";
|
||||
import {getPrincipalIds, getCurrentUserPrincipalId, getClusterIds} from "../rancher/rancher_users_utils.js"
|
||||
|
||||
|
|
@ -42,14 +43,13 @@ const projectsMetric = new Gauge('test_projects')
|
|||
|
||||
export function setup() {
|
||||
// log in
|
||||
if (!login(baseUrl, {}, username, password)) {
|
||||
if (!login(baseUrl, {}, username, password).status === 200) {
|
||||
fail(`could not login into cluster`)
|
||||
}
|
||||
const cookies = getCookies(baseUrl)
|
||||
|
||||
// delete leftovers, if any
|
||||
cleanup(cookies)
|
||||
|
||||
// return data that remains constant throughout the test
|
||||
return {
|
||||
cookies: cookies,
|
||||
|
|
@ -64,11 +64,12 @@ function cleanup(cookies) {
|
|||
check(res, {
|
||||
'/v1/management.cattle.io.projects returns status 200': (r) => r.status === 200,
|
||||
})
|
||||
JSON.parse(res.body)["data"].filter(r => r["spec"]["description"].startsWith("Test ")).forEach(r => {
|
||||
res = http.del(`${baseUrl}/v3/projects/${r["id"].replace("/", ":")}`, {cookies: cookies})
|
||||
check(res, {
|
||||
'DELETE /v3/projects returns status 200': (r) => r.status === 200,
|
||||
})
|
||||
let { _, projectArray } = projectUtil.getNormanProjectsMatchingName(baseUrl, cookies, "Test ")
|
||||
console.log(`Found ${projectArray.length} projects to clean up`)
|
||||
projectArray.forEach(r => {
|
||||
let delRes = projectUtil.deleteNormanProject(baseUrl, cookies, r["id"])
|
||||
if (delRes.status !== 200 && delRes.status !== 204) deleteAllFailed = true
|
||||
sleep(0.5)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export function createUsers(cookies) {
|
|||
const id = JSON.parse(res.body)["id"]
|
||||
|
||||
for (let j = 0; j < bindingsPerUser; j++) {
|
||||
const res = retryOnConflict(() => {
|
||||
const res = retryOnConflict(9, () => {
|
||||
return http.post(
|
||||
`${baseUrl}/v3/globalrolebindings`,
|
||||
JSON.stringify({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
export function sizeOfHeaders(headers) {
|
||||
return Object.keys(headers).reduce((sum, key) => sum + key.length + headers[key].length, 0);
|
||||
}
|
||||
|
||||
export function trackResponseSizePerURL(res, tags, headerDataRecv, epDataRecv) {
|
||||
// Add data points for received data
|
||||
headerDataRecv.add(sizeOfHeaders(res.headers));
|
||||
if (res.hasOwnProperty('body') && res.body) {
|
||||
epDataRecv.add(res.body.length, tags);
|
||||
} else {
|
||||
epDataRecv.add(0, tags);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { check, fail, sleep } from 'k6';
|
||||
import http, { del } from 'k6/http'
|
||||
import { retryUntilExpected } from "../rancher/rancher_utils.js";
|
||||
|
||||
export const schemasTag = { url: `/v1/schemas/<schemaID>` }
|
||||
export const schemaDefinitionTag = { url: `/v1/schemaDefinitions/<schemaID>` }
|
||||
|
|
@ -22,7 +23,7 @@ export function verifySchemaExistsPolling(baseUrl, cookies, existingID, expected
|
|||
let currentVersion = ""
|
||||
// Poll schemaDefinition until receiving a 200
|
||||
while (new Date() - timeWas < timeoutMs) {
|
||||
res = retryUntilExpected(200, () => { return getSchema(baseUrl, cookies, existingID) })
|
||||
res = retryUntilExpected(200, 9, () => { return getSchema(baseUrl, cookies, existingID) })
|
||||
timeSpent = new Date() - timeWas
|
||||
console.log("SCHEMA STATUS: ", res.status)
|
||||
if (res.status === 200) {
|
||||
|
|
@ -62,7 +63,7 @@ export function verifySchemaDefinitionExistsPolling(baseUrl, cookies, existingID
|
|||
let res = null
|
||||
// Poll schemaDefinition until receiving a 200
|
||||
while (new Date() - timeWas < timeoutMs) {
|
||||
res = retryUntilExpected(200, () => { return getSchemaDefinition(baseUrl, cookies, existingID) })
|
||||
res = retryUntilExpected(200, 9, () => { return getSchemaDefinition(baseUrl, cookies, existingID) })
|
||||
timeSpent = new Date() - timeWas
|
||||
console.log("SCHEMADEFINITION STATUS: ", res.status)
|
||||
if (res.status === 200) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { getCookies, login } from "../rancher/rancher_utils.js";
|
|||
import { Trend } from 'k6/metrics';
|
||||
import * as crdUtil from "../crds/crd_utils.js";
|
||||
import { verifySchemaExistsPolling, verifySchemaDefinitionExistsPolling } from "./schema_utils.js"
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 1
|
||||
const perVuIterations = __ENV.PER_VU_ITERATIONS || 1
|
||||
|
|
@ -120,7 +121,7 @@ export function checkAndBuildCRDArray(cookies, crdArray) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
sleep(0.25)
|
||||
}
|
||||
let { res: res, crdArray: crds } = crdUtil.getCRDsMatchingName(baseUrl, cookies, namePrefix)
|
||||
|
|
@ -139,7 +140,7 @@ export function generateCRDArray(cookies) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
}
|
||||
|
||||
let crdArray = crdUtil.getCRDsMatchingNameVersions(baseUrl, cookies, namePrefix, 2)
|
||||
|
|
@ -150,7 +151,7 @@ export function generateCRDArray(cookies) {
|
|||
let finalCRD = crdArray[crdArray.length - 1]
|
||||
let schemaID = finalCRD.spec.group + "." + finalCRD.spec.names.singular
|
||||
let { res, timeSpent } = verifySchemaDefinitionExistsPolling(baseUrl, cookies, schemaID, finalCRD.spec.versions[1].name, crdUtil.crdRefreshDelayMs * 5)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
timePolled.add(timeSpent, crdUtil.schemaDefinitionTag)
|
||||
if (res.status != 200) {
|
||||
|
|
@ -160,7 +161,7 @@ export function generateCRDArray(cookies) {
|
|||
crdArray.forEach((crd, i) => {
|
||||
schemaID = crd.spec.group + "." + crd.spec.names.singular
|
||||
let { res, timeSpent } = verifySchemaDefinitionExistsPolling(baseUrl, cookies, schemaID, crd.spec.versions[1].name, crdUtil.crdRefreshDelayMs * 5)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
timePolled.add(timeSpent, crdUtil.schemaDefinitionTag)
|
||||
if (res.status != 200) {
|
||||
|
|
@ -185,7 +186,7 @@ export function verifySchemas(data) {
|
|||
}
|
||||
res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
|
||||
modifyCRD.spec.versions[2] = newSchema
|
||||
// Unset previously stored version
|
||||
|
|
@ -198,19 +199,19 @@ export function verifySchemas(data) {
|
|||
let existingID = modifyCRD.spec.group + "." + modifyCRD.spec.names.singular
|
||||
existingIDs.push(existingID)
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
updated += 1
|
||||
})
|
||||
|
||||
existingIDs.forEach(id => {
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, data.cookies, id, newSchema.name, crdUtil.crdRefreshDelayMs)
|
||||
let schemaBytes = res.body.length
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
console.log("3rd definition");
|
||||
({ res: res, timeSpent: timeSpent } = verifySchemaDefinitionExistsPolling(baseUrl, data.cookies, id, newSchema.name, crdUtil.crdRefreshDelayMs * 5))
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemaDefinitionTag)
|
||||
let schemaDefBytes = res.body.length
|
||||
check(schemaDefBytes, {
|
||||
|
|
@ -225,33 +226,33 @@ export function verifySchemas(data) {
|
|||
// get latest version of each CRD
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
let updatedCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
// swap out active versions
|
||||
updatedCRD.spec.versions[2].storage = false
|
||||
updatedCRD.spec.versions[2].served = false
|
||||
updatedCRD.spec.versions[1].storage = true
|
||||
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, updatedCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(crdUtil.crdRefreshDelaySeconds + 1)
|
||||
res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
updatedCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
updatedCRD.status.storedVersions.splice(1, 1)
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, updatedCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
reverted += 1
|
||||
})
|
||||
|
||||
existingIDs.forEach(id => {
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, data.cookies, id, CRDs[0].spec.versions[1].name, crdUtil.crdRefreshDelayMs)
|
||||
let schemaBytes = res.body.length
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
console.log("4th definition");
|
||||
({ res: res, timeSpent: timeSpent } = verifySchemaDefinitionExistsPolling(baseUrl, data.cookies, id, CRDs[0].spec.versions[1].name, crdUtil.crdRefreshDelayMs * 5))
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemaDefinitionTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemaDefinitionTag)
|
||||
let schemaDefBytes = res.body.length
|
||||
check(schemaDefBytes, {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { getCookies, login } from "../rancher/rancher_utils.js";
|
|||
import { Trend } from 'k6/metrics';
|
||||
import * as crdUtil from "../crds/crd_utils.js";
|
||||
import { verifySchemaExistsPolling } from "./schema_utils.js"
|
||||
import * as k6Util from "../generic/k6_utils.js";
|
||||
|
||||
const vus = __ENV.K6_VUS || 1
|
||||
const perVuIterations = __ENV.PER_VU_ITERATIONS || 1
|
||||
|
|
@ -105,7 +106,7 @@ export function generateCRDArray(cookies) {
|
|||
for (let i = 0; i < crdCount; i++) {
|
||||
let crdSuffix = `${i}`
|
||||
let res = crdUtil.createCRD(baseUrl, cookies, crdSuffix)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdsTag, headerDataRecv, epDataRecv)
|
||||
}
|
||||
|
||||
let crdArray = crdUtil.getCRDsMatchingNameVersions(baseUrl, cookies, namePrefix, 2)
|
||||
|
|
@ -116,7 +117,7 @@ export function generateCRDArray(cookies) {
|
|||
let finalCRD = crdArray[crdArray.length - 1]
|
||||
let schemaID = finalCRD.spec.group + "." + finalCRD.spec.names.singular
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, cookies, schemaID, finalCRD.spec.versions[1].name, crdUtil.crdRefreshDelayMs * 5)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
if (res.status != 200) {
|
||||
|
|
@ -126,7 +127,7 @@ export function generateCRDArray(cookies) {
|
|||
crdArray.forEach((crd, i) => {
|
||||
schemaID = crd.spec.group + "." + crd.spec.names.singular
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, cookies, schemaID, crd.spec.versions[1].name, crdUtil.crdRefreshDelayMs * 5)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
console.log("TIME SPENT: ", timeSpent)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
if (res.status != 200) {
|
||||
|
|
@ -151,7 +152,7 @@ export function verifySchemas(data) {
|
|||
}
|
||||
res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
let modifyCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
|
||||
modifyCRD.spec.versions[2] = newSchema
|
||||
// Unset previously stored version
|
||||
|
|
@ -164,14 +165,14 @@ export function verifySchemas(data) {
|
|||
let existingID = modifyCRD.spec.group + "." + modifyCRD.spec.names.singular
|
||||
existingIDs.push(existingID)
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, modifyCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
updated += 1
|
||||
})
|
||||
|
||||
existingIDs.forEach(id => {
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, data.cookies, id, newSchema.name, crdUtil.crdRefreshDelayMs)
|
||||
let schemaBytes = res.body.length
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
})
|
||||
|
||||
|
|
@ -182,28 +183,28 @@ export function verifySchemas(data) {
|
|||
// get latest version of each CRD
|
||||
let res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
let updatedCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
// swap out active versions
|
||||
updatedCRD.spec.versions[2].storage = false
|
||||
updatedCRD.spec.versions[2].served = false
|
||||
updatedCRD.spec.versions[1].storage = true
|
||||
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, updatedCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
sleep(crdUtil.crdRefreshDelaySeconds + 1)
|
||||
res = crdUtil.getCRD(baseUrl, data.cookies, crd.id)
|
||||
updatedCRD = JSON.parse(res.body)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.crdTag, headerDataRecv, epDataRecv)
|
||||
updatedCRD.status.storedVersions.splice(1, 1)
|
||||
res = crdUtil.updateCRD(baseUrl, data.cookies, updatedCRD)
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.putCRDTag, headerDataRecv, epDataRecv)
|
||||
reverted += 1
|
||||
})
|
||||
|
||||
existingIDs.forEach(id => {
|
||||
let { res, timeSpent } = verifySchemaExistsPolling(baseUrl, data.cookies, id, CRDs[0].spec.versions[1].name, crdUtil.crdRefreshDelayMs)
|
||||
let schemaBytes = res.body.length
|
||||
crdUtil.trackDataMetricsPerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
k6Util.trackResponseSizePerURL(res, crdUtil.schemasTag, headerDataRecv, epDataRecv)
|
||||
timePolled.add(timeSpent, crdUtil.schemasTag)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue