Skip to content

Commit 4fe66c8

Browse files
committed
chore: add error context to os4 integration tests
1 parent e5f4ffd commit 4fe66c8

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

test/setup/platforms/openshift4.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,25 @@ async function tryDescribingResourceToFile(
7272
name: string,
7373
namespace: string,
7474
): Promise<void> {
75-
return kubectl
76-
.describeKubernetesResource(kind, name, namespace)
77-
.then((description) => {
78-
const fileName = `${kind}-${name}-${namespace}`;
79-
const filePath = process.env.CI
80-
? // The directory is generated by CircleCI config (see .circleci/config.yml).
81-
`/tmp/logs/test/integration/openshift4/${fileName}`
82-
: `${tmpdir()}/${fileName}`;
83-
writeFileSync(filePath, description);
84-
console.log(`Description for ${kind} ${name} is stored in ${filePath}`);
85-
})
86-
.catch(() =>
87-
console.log(
88-
`Could not describe ${kind} ${name} in namespace ${namespace}`,
89-
),
75+
try {
76+
const description = await kubectl.describeKubernetesResource(
77+
kind,
78+
name,
79+
namespace,
9080
);
81+
const fileName = `${kind}-${name}-${namespace}`;
82+
const filePath = process.env.CI
83+
? // The directory is generated by CircleCI config (see .circleci/config.yml).
84+
`/tmp/logs/test/integration/openshift4/${fileName}`
85+
: `${tmpdir()}/${fileName}`;
86+
writeFileSync(filePath, description);
87+
console.log(`Description for ${kind} ${name} is stored in ${filePath}`);
88+
} catch (error) {
89+
console.log(
90+
`Could not describe ${kind} ${name} in namespace ${namespace}`,
91+
{ error },
92+
);
93+
}
9194
}
9295

9396
export async function clean(): Promise<void> {

0 commit comments

Comments
 (0)