diff --git a/integration-tests/js-compute/fixtures/app/src/assertions.js b/integration-tests/js-compute/fixtures/app/src/assertions.js index 48b1727172..f747c89bfa 100644 --- a/integration-tests/js-compute/fixtures/app/src/assertions.js +++ b/integration-tests/js-compute/fixtures/app/src/assertions.js @@ -55,7 +55,7 @@ export { assert as strictEqual }; export function ok(truthy, code) { if (!truthy) { throw new Error( - `Expected ${code ? ' ' + code : ''}to be truthy - Found \`${JSON.stringify(prettyPrintSymbol(truthy))}\``, + `Expected ${code ? code + ' ' : ''}to be truthy - Found \`${JSON.stringify(prettyPrintSymbol(truthy))}\``, ); } } diff --git a/integration-tests/js-compute/fixtures/app/src/compute.js b/integration-tests/js-compute/fixtures/app/src/compute.js index 86f2c34edd..504453e6d1 100644 --- a/integration-tests/js-compute/fixtures/app/src/compute.js +++ b/integration-tests/js-compute/fixtures/app/src/compute.js @@ -5,8 +5,10 @@ import { purgeSurrogateKey, vCpuTime } from 'fastly:compute'; routes.set('/compute/get-vcpu-ms', () => { const cpuTime = vCpuTime(); strictEqual(typeof cpuTime, 'number'); - ok(cpuTime > 0); - ok(cpuTime < 3000); + // We can't assert > 0; this only claims millisecond resolution, + // and we hopefully spent less than 500us starting. + ok(cpuTime >= 0, 'cpuTime >= 0'); + ok(cpuTime < 3000, 'cputime < 3000'); const arr = new Array(100_000).fill(1); for (let j = 1; j < 100; j++) { for (let i = 1; i < 100_000; i++) { @@ -14,8 +16,8 @@ routes.set('/compute/get-vcpu-ms', () => { } } const cpuTime2 = vCpuTime(); - ok(cpuTime2 > cpuTime); - ok(cpuTime2 - cpuTime > 1); + ok(cpuTime2 > cpuTime, 'cpuTime2 > cpuTime'); + ok(cpuTime2 - cpuTime > 1, 'cpuTime2 - cpuTime > 1'); return pass('ok'); });