Skip to content

Commit

Permalink
fix: Gauge shows huge values on test start (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
JorTurFer authored Aug 20, 2023
1 parent e766ad9 commit b7f22cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ generate-k6:
login-k6:
@./k6 login cloud --token $(TF_GRAFANA_TOKEN)

execute-k6: execute-k6-scaledobjects-cases
execute-k6: # execute-k6-scaledobjects-cases
@$(K6_ENVS) TARGET_SCALABLEDOBJECTS=1000 TARGET_METRICS=1 ./k6 run --out cloud tests/test-scaledobject.js

execute-k6-scaledobjects-cases:
execute-k6-scaledobjects-cases: # disabled temporally to reduce execution times + grafana VUs
# Increasing ScaledObject count (10, 100, 1000 metrics in total)
@$(K6_ENVS) TARGET_SCALABLEDOBJECTS=10 TARGET_METRICS=1 ./k6 run --out cloud tests/test-scaledobject.js
@$(K6_ENVS) TARGET_SCALABLEDOBJECTS=100 TARGET_METRICS=1 ./k6 run --out cloud tests/test-scaledobject.js
Expand Down
8 changes: 5 additions & 3 deletions shared/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function waitForResourceCount(
} while (currentScaledObjectCount != expected && tries < maxTries);
if (currentScaledObjectCount != expected) {
throw Error(
`expected resource count not reached afer ${tries * interval} seconds. Expected ${expected}, got ${currentScaledObjectCount}`
`expected resource count not reached afer ${
tries * interval
} seconds. Expected ${expected}, got ${currentScaledObjectCount}`
);
}
}
Expand All @@ -29,7 +31,7 @@ export function generatePrefix(testCase) {
return crypto.md5(testCase, "hex");
}

export function generateGauge(name){
export function generateGauge(name) {
var gauge = new Gauge(name);
return gauge;
}
}
7 changes: 5 additions & 2 deletions tests/test-scaledobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ workload.setExecutionPrefix(casePrefix);

export const options = {
vus: 1,
setupTimeout: "10m",
setupTimeout: "15m",
teardownTimeout: "10m",
duration: "5m",
ext: {
Expand Down Expand Up @@ -59,10 +59,13 @@ export function setup() {
20,
15
);

// Wait a minute to stabilizate prometheus metrics before the test
sleep(60);
}

export default function () {
sleep(10);
sleep(5);
GaugeKEDAInternalLatency.add(prometheus.getLag(workload.getNamespaceName()));
}

Expand Down

0 comments on commit b7f22cc

Please sign in to comment.