Runner test: don't compare the host's clock speed between two reads
The agent reads /proc/cpuinfo once for the job's runner report and again for the log line, and on GitHub's hosted runners the MHz moved between the two (3241 vs 3245), failing CI. Compare the processor and vCPU count.
1 file changed+2−1
modifiedcontainers/runner/test/job.test.ts+2−1View file
| @@ -954,7 +954,8 @@ | ||
| 954 | 954 | expect(api.logText()).toContain("Runner: image diffinery-runner:abc123, in fra06, EEUR, container d0"); |
| 955 | 955 | // A hosted runner also names its host's processor and, at the end, the share of its vCPUs' time the host took. |
| 956 | 956 | if (existsSync("/proc/cpuinfo")) { |
| 957 | - expect(api.logText()).toContain(`Host: ${runner.cpu}`); | |
| 957 | + // The clock speed is read again for the log line, and it moves between reads on a busy host. | |
| 958 | + expect(api.logText()).toContain(`Host: ${String(runner.cpu).replace(/, \d+ MHz$/, "")}`); | |
| 958 | 959 | expect(api.logText()).toMatch(/Host: \d+% of the vCPUs' time went to other work on the host \(steal\)/); |
| 959 | 960 | } |
| 960 | 961 | expect(api.completion).toMatchObject({ conclusion: "failure", failure: { step: 0 } }); |