ci(test): Verify per-session video layout for Dynamic Grid (Docker + K8s) - #3192
Conversation
PR Summary by QodoCI tests: assert Dynamic Grid videos are stored per-session (Docker + K8s)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
…K8s) Assert that Dynamic Grid recordings are stored one-per-session at <assets>/<sessionId>/<file>.mp4 - never flat in the assets root and never double-nested - covering SE_VIDEO_SESSION_SUBFOLDER behaviour for both inline recording and the external video sidecar. - Kubernetes Dynamic Grid test: collect videos cluster-agnostically (kubectl exec/cp on non-minikube, hostPath on minikube) and assert the per-session subfolder layout before the ffmpeg integrity check. - Docker Dynamic Grid test: add a CHECK_VIDEO_SESSION_LAYOUT gate that fails on a flat (depth 1) or double-nested (depth >=3) recording; enable it on the inline (test_standalone_docker) and external-sidecar (test_*_video_sidecar) scenarios. - Retain local recordings for the check via SE_UPLOAD_RETAIN_LOCAL_FILE (default false) passed through the node/standalone-docker compose files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
b1bbe09 to
fc14f27
Compare
Code Review by Qodo
1. Stale videos fail layout check
|
| base="${ASSETS_HOST_PATH%/}" | ||
| video_files=$(find "${base}" -type f -name "*.mp4") | ||
| # Copy while preserving the per-session subfolder layout so same-named recordings from | ||
| # different sessions do not collide. |
There was a problem hiding this comment.
1. Stale videos fail layout check 🐞 Bug ☼ Reliability
tests/k8s/make/dynamic_grid_test.sh now validates that no .mp4 exists directly under the assets root, but it never clears the underlying hostPath/PV directory before scanning it. Because the PV’s backing directory is retained, stale recordings from earlier runs can trigger false failures (or make the “videos exist” check pass even if this run produced none).
Agent Prompt
## Issue description
The K8s Dynamic Grid test collects and validates all `*.mp4` under the assets base path, but the test does not clean the backing assets directory before the run. Since the PV is hostPath-backed and configured to retain data, stale `*.mp4` files from previous runs can be included in `video_files` and cause the new “flat video” assertion to fail (or satisfy the “non-empty” check without producing new recordings).
## Issue Context
- The script prepares `${ASSETS_HOST_PATH}` with `mkdir/chmod` only (no cleanup), then scans all `*.mp4` and fails if any are in the assets root.
- The PV is `hostPath: /tmp/selenium/assets` with `persistentVolumeReclaimPolicy: Retain`, so artifacts can persist across runs.
## Fix Focus Areas
- tests/k8s/make/dynamic_grid_test.sh[149-152]
- tests/k8s/make/dynamic_grid_test.sh[256-309]
- kubernetes/DynamicGrid/BaseConfig/pvc.yaml[12-16]
## Suggested fix
Add an explicit cleanup step for old `*.mp4` files in the assets directory before running the browsers/tests (and/or before collecting videos). For non-minikube clusters, do the cleanup via `kubectl exec` against the pod mounting `/opt/selenium/assets` once the deployment is ready.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Description
Adds test coverage asserting that Dynamic Grid recordings are stored one per session at
<assets>/<sessionId>/<file>.mp4— never flat in the assets root and never double-nested — coveringSE_VIDEO_SESSION_SUBFOLDERbehaviour for both inline recording and the external video sidecar.Verifies the Grid-side change SeleniumHQ/selenium@47edefb ("Store Dynamic Grid videos in a per-session subfolder via SE_VIDEO_SESSION_SUBFOLDER").
Changes
tests/k8s/make/dynamic_grid_test.sh): collect videos cluster-agnostically —kubectl exec/cpfrom the assets pod on any cluster, hostPath fast path on minikube — preserving the per-session layout, then assert every recording sits in a per-session subfolder before the ffmpeg integrity check.Makefile): newCHECK_VIDEO_SESSION_LAYOUTgate that fails on a flat (depth 1, inline regression) or double-nested (depth ≥3, sidecar regression) recording, and requires ≥1 per-session recording. Enabled on the inline (test_standalone_docker) and external-sidecar (test_standalone_docker_video_sidecar,test_node_docker_video_sidecar) scenarios.SE_UPLOAD_RETAIN_LOCAL_FILE(defaultfalse, no behaviour change elsewhere) passed through the node/standalone-docker compose files, so the per-session recordings persist alongside the upload for verification.Both location and ffmpeg output integrity are checked in every scenario.
Verification
Ran locally (arm64, image tag
4.46.0-20260804):video-image="false")🤖 Generated with Claude Code