Skip to content

Commit 5fcf166

Browse files
committed
test: ignore 'still running' heartbeat in stdout assertions
The 10s long-running silent timeout fires on slow CI runners and gets captured by stdout filters that match '<job> >' prefixes, breaking equality assertions. Exclude heartbeat lines so the tests only assert on real job output.
1 parent fab937b commit 5fcf166

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

tests/test-cases/predefined-variables/integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe("predefined-variables", () => {
141141
expected += `test-job > ${key}=${envVars[key]}\n`;
142142
});
143143

144-
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ")).join("\n");
144+
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ") && !f.endsWith("> still running...")).join("\n");
145145
expect(filteredStdout).toEqual(expected.trim());
146146
expect(jobIdSpy).toHaveBeenCalledTimes(2);
147147
});
@@ -178,7 +178,7 @@ CI_SERVER_SHELL_SSH_PORT: 8022
178178
Object.keys(envVars).forEach(key => {
179179
expected += `test-job > ${key}=${envVars[key]}\n`;
180180
});
181-
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ")).join("\n");
181+
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ") && !f.endsWith("> still running...")).join("\n");
182182
expect(filteredStdout).toEqual(expected.trim());
183183
expect(jobIdSpy).toHaveBeenCalledTimes(2);
184184
});
@@ -218,7 +218,7 @@ CI_SERVER_SHELL_SSH_PORT: 8022
218218
expected += `test-job > ${key}=${envVars[key]}\n`;
219219
});
220220

221-
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ")).join("\n");
221+
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("test-job > ") && !f.endsWith("> still running...")).join("\n");
222222
expect(filteredStdout).toEqual(expected.trim());
223223
expect(jobIdSpy).toHaveBeenCalledTimes(2);
224224
});

tests/test-cases/services/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ test.concurrent("services <services:entrypoint should support variable expansion
189189
stateDir: ".gitlab-ci-local-entrypoint",
190190
}, writeStreams);
191191

192-
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("job1 >")).join("\n");
192+
const filteredStdout = writeStreams.stdoutLines.filter(f => f.startsWith("job1 >") && !f.endsWith("> still running...")).join("\n");
193193
expect(filteredStdout).toEqual(`
194194
job1 > should support single quote [']
195195
job1 > should support double quote ["]

0 commit comments

Comments
 (0)