Skip to content

Commit 8cec7b2

Browse files
fix: resilient namespace deletion in TeardownReporter with retry
1 parent f2defd3 commit 8cec7b2

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineConfig({
3333
{ text: "Examples", link: "/examples/" },
3434
{ text: "Overlay Testing", link: "/overlay/" },
3535
{
36-
text: "v1.1.34",
36+
text: "v1.1.35",
3737
items: [{ text: "Changelog", link: "/changelog" }],
3838
},
3939
],

docs/changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.1.34] - Current
5+
## [1.1.35] - Current
6+
7+
### Fixed
8+
9+
- **Resilient namespace deletion in TeardownReporter**: Retry once with 5s delay and catch errors to prevent cluster connectivity failures (e.g. DNS `EAI_AGAIN`) from crashing Playwright before it generates the HTML report.
10+
11+
## [1.1.34]
612

713
### Added
814

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@red-hat-developer-hub/e2e-test-utils",
3-
"version": "1.1.34",
3+
"version": "1.1.35",
44
"description": "Test utilities for RHDH E2E tests",
55
"license": "Apache-2.0",
66
"repository": {

src/playwright/teardown-reporter.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,26 @@ export default class TeardownReporter implements Reporter {
117117
}
118118
}
119119

120-
// Delete namespaces only in CI
120+
// Retry + catch to avoid crashing Playwright if the cluster becomes unreachable.
121+
const maxAttempts = 2;
121122
if (process.env.CI === "true") {
122123
for (const ns of namespaces) {
123124
console.log(
124125
`[TeardownReporter] Deleting namespace "${ns}" (project: ${projectName})`,
125126
);
126-
await k8sClient.deleteNamespace(ns);
127+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
128+
try {
129+
await k8sClient.deleteNamespace(ns);
130+
break;
131+
} catch (error) {
132+
console.error(
133+
`[TeardownReporter] Failed to delete namespace "${ns}" (attempt ${attempt}/${maxAttempts}):`,
134+
error,
135+
);
136+
if (attempt < maxAttempts)
137+
await new Promise((r) => setTimeout(r, 5000));
138+
}
139+
}
127140
}
128141
}
129142
}

0 commit comments

Comments
 (0)