Skip to content

Commit

Permalink
add a check for stabilization before the test
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Aug 20, 2023
1 parent 24fa241 commit 9da9330
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
18 changes: 0 additions & 18 deletions shared/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@ export function waitForResourceCount(
}
}

export function waitForLagStabilization(
namespace,
threshold,
maxTries,
interval
) {
let lag = 0;
let tries = 0;
do {
tries++;
sleep(interval);
lag = prometheus.getLag(namespace);
} while (lag > threshold && tries < maxTries);
if (lag > threshold) {
throw Error(`lag not stabilized after ${tries * interval} seconds.`);
}
}

export function generatePrefix(testCase) {
return crypto.md5(testCase, "hex");
}
Expand Down
5 changes: 3 additions & 2 deletions tests/test-scaledobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ export function setup() {
20,
15
);
// Wait for metrics stabilization before starting the tests
utils.waitForLagStabilization(workload.getNamespaceName(), 100, 6, 10);

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

export default function () {
Expand Down

0 comments on commit 9da9330

Please sign in to comment.