Skip to content

Commit

Permalink
test: add wait f/ metrics-server to serve Pepr metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
btlghrants committed Jan 6, 2025
1 parent 54d97b9 commit 2a4e2bc
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion hack/load.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ program
log(await cmd.run(), "");

//
// run test
// run deploy
//

log(`Pepr CLI version`);
Expand Down Expand Up @@ -479,6 +479,27 @@ program
});
log({ cmd: cmd.cmd, cwd: cmd.cwd, env });
log(await cmd.run(), "");

log(`Wait for metrics on the Pepr controller to become available`);
const start = Date.now();
const max = lib.toMs("2m");
while (true) {
const now = Date.now();
const dur = now - start;
if (dur > max) {
console.error(`Timeout waiting for metrics-server to be ready.`);
process.exit(1);
}

cmd = new Cmd({ cmd: `kubectl top --namespace pepr-system pod --no-headers`, env });
let res = await cmd.runRaw();
if (res.exitcode === 0) {
log({ max: lib.toHuman(max), actual: lib.toHuman(dur) }, "");
break;
}

await nap(lib.toMs("5s"));
}
});

program
Expand Down

0 comments on commit 2a4e2bc

Please sign in to comment.