Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 5e77567

Browse files
committed
#21 Log all jobs in namespace
Getting individual jobs is harder now, as the name has a random string at the end. Listing all jobs is more helpfull anyway, as it also lists jobs for hooks
1 parent 8307fd9 commit 5e77567

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/integration/helpers.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ async function getScan(name) {
3333
return scan;
3434
}
3535

36-
async function logJob(name) {
36+
async function logJobs() {
3737
try {
38-
const { body: job } = await k8sBatchApi.readNamespacedJob(name, namespace);
39-
console.log(`Job: '${name}' Spec:`);
40-
console.dir(job.spec);
41-
console.log(`Job: '${name}' Status:`);
42-
console.dir(job.status);
38+
const { body: jobs } = await k8sBatchApi.listNamespacedJob(namespace);
39+
40+
for (const job of jobs.items) {
41+
console.log(`Job: '${job.metadata.name}' Spec:`);
42+
console.dir(job.spec);
43+
console.log(`Job: '${job.metadata.name}' Status:`);
44+
console.dir(job.status);
45+
}
4346
} catch (error) {
44-
console.info(`Job: '${name} not found.'`);
47+
console.info(`Failed to list Jobs'`);
4548
}
4649
}
4750

@@ -96,8 +99,7 @@ async function scan(name, scanType, parameters = [], timeout = 180) {
9699
const scan = await getScan(actualName);
97100
console.log("Last Scan State:");
98101
console.dir(scan);
99-
await logJob(`scan-${actualName}`);
100-
await logJob(`parse-${actualName}`);
102+
await logJobs();
101103

102104
throw new Error("timed out while waiting for scan results");
103105
}

0 commit comments

Comments
 (0)