You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add diagnostic log collection on test failure
Adds collectDiagnosticLogs() to KubernetesClientHelper that captures
cluster state (events, pods, deployments, statefulsets, routes,
configmaps, per-container pod logs) to files on test failure.
TeardownReporter now tracks failed projects and collects diagnostics
before namespace deletion. Log collection runs on both CI and local;
namespace deletion remains CI-only.
Bumps version to 1.1.34.
Copy file name to clipboardExpand all lines: docs/changelog.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,27 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
-
## [1.1.33] - Current
5
+
## [1.1.34] - Current
6
+
7
+
### Added
8
+
9
+
-**Diagnostic log collection on failure**: `collectDiagnosticLogs(namespace, outputDir?)` on `KubernetesClientHelper` captures comprehensive cluster state (events, pod status, deployments, statefulsets, routes, and per-container pod logs including init containers and previous restarts) to files under `node_modules/.cache/e2e-test-results/logs/<namespace>/`. Uses `kubectl` for cross-platform compatibility. Empty files (e.g. no previous logs) are not created.
10
+
-**TeardownReporter collects diagnostics on test failure**: When any test in a project fails, the teardown reporter automatically calls `collectDiagnosticLogs` before namespace deletion. Diagnostic collection runs on both CI and local; namespace deletion remains CI-only.
11
+
-**Per-container pod log collection**: Logs are collected per-container (init + app containers) instead of `--all-containers`, which fails entirely if any container hasn't started. Files saved to `pods/<pod-name>/<container-name>.log` and `pods/<pod-name>/<container-name>.previous.log`.
12
+
13
+
### Changed
14
+
15
+
-**TeardownReporter tracks test failures**: Added `_projectsWithFailures` set to track which projects had test failures, so diagnostic logs are only collected when needed.
16
+
-**TeardownReporter active on non-CI**: The reporter now processes `onTestEnd`/`onEnd` regardless of `CI` env var. Log collection runs always; namespace deletion is still gated on `CI=true`.
17
+
18
+
## [1.1.33]
6
19
7
20
### Added
8
21
9
22
-**Automatic Vault secret loading for local development**: Set `VAULT=1` or `VAULT=true` to automatically fetch secrets from HashiCorp Vault during global setup. Handles OIDC login, fetches global and per-workspace secrets, and injects them into `process.env`. Only secret key names are logged, never values. Configurable via `VAULT_ADDR` and `VAULT_BASE_PATH` env vars. Logs a Slack channel (`#rhdh-e2e-tests`) when permission is denied.
10
23
24
+
## [1.1.32]
25
+
11
26
### Fixed
12
27
13
28
-**Normalize `-dynamic` suffix in `extractPluginName`**: Plugins whose metadata `dynamicArtifact` is a local path (ending in `-dynamic`) were not matched during PR OCI resolution or config injection, because the metadata map key included the `-dynamic` suffix while OCI URL lookups did not. `extractPluginName` now strips the `-dynamic` suffix so local paths and OCI refs for the same logical plugin produce the same key. ([RHDHBUGS-2987](https://issues.redhat.com/browse/RHDHBUGS-2987))
When tests fail, the framework automatically collects cluster diagnostics (pod logs, events, deployments) to `node_modules/.cache/e2e-test-results/logs/<namespace>/`. This includes per-container logs for all pods (init and app containers), with previous restart logs when available.
286
+
287
+
Check these files first when debugging deployment or pod failures — they're often more useful than Playwright's HTML report for infrastructure issues.
288
+
289
+
See [Kubernetes Client — Diagnostic Log Collection](/guide/utilities/kubernetes-client#diagnostic-log-collection) for the full list of collected resources and API details.
290
+
283
291
## Error Handling Checklist
284
292
285
293
-[ ] Use specific error messages that include context
Collects comprehensive cluster diagnostics and saves them to files. Uses `kubectl` for cross-platform compatibility (OpenShift, EKS, GKE, etc.). OpenShift-specific resources (routes) are collected on a best-effort basis.
|`events.txt`| Namespace events sorted by timestamp |
143
+
|`pods.txt`| Pod status (`kubectl get pods -o wide`) |
144
+
|`describe-pods.txt`| Full pod descriptions |
145
+
|`deployments.txt`| Deployment status |
146
+
|`describe-deployments.txt`| Full deployment descriptions |
147
+
|`statefulsets.txt`| StatefulSet status |
148
+
|`routes.txt`| OpenShift routes (skipped on non-OpenShift clusters) |
149
+
|`pods/<pod>/<container>.log`| Current logs per container (init + app) |
150
+
|`pods/<pod>/<container>.previous.log`| Previous restart logs (only if pod restarted) |
151
+
152
+
**Key behaviors:**
153
+
- Logs are collected per-container rather than `--all-containers`, so a failed init container doesn't block collection of other container logs
154
+
- Empty files are not created (e.g., when there are no previous logs)
155
+
- Resource types that don't exist on the cluster (e.g., routes on non-OpenShift) are silently skipped
156
+
- All resource collection runs in parallel via `Promise.allSettled`
157
+
158
+
**Automatic collection on test failure:**
159
+
160
+
In the overlay testing flow, you don't need to call this manually. The built-in `TeardownReporter` automatically calls `collectDiagnosticLogs` for any project that had test failures. This works on both CI and local runs.
This runs automatically on **both CI and local** — no configuration needed. Namespace deletion remains CI-only.
294
+
295
+
**When using `run-e2e.sh`**, logs are written relative to the repo root. When running from a workspace (`cd workspaces/my-plugin/e2e-tests && yarn test`), they're relative to the `e2e-tests/` directory.
296
+
297
+
**Logs are only collected for projects with failures.** If all tests pass, no diagnostic logs are written.
298
+
299
+
To collect diagnostics manually (e.g., from a custom script):
0 commit comments