Skip to content

fix run-tests script#82

Merged
ttbombadil merged 2 commits intomainfrom
ref
Apr 8, 2026
Merged

fix run-tests script#82
ttbombadil merged 2 commits intomainfrom
ref

Conversation

@ttbombadil
Copy link
Copy Markdown
Collaborator

No description provided.

Root causes of E2E failures:
1. Docker Desktop becomes temporarily unresponsive after 74s of
   heavy Docker tests on macOS. The single 'docker info' check
   right after the tests was failing, causing the E2E server to
   start without FORCE_DOCKER=1. All 5 sandbox runners then
   attempted eager docker checks, found the socket broken, and
   fell back to local-only mode (which has race conditions).

   Fix: replace the one-shot 'if docker info' with a 30-second
   retry loop (10 × 3s) that waits for Docker Desktop to recover
   before starting the E2E server and setting FORCE_DOCKER=1.

2. ws.on('close') sets clientState.runner = null while
   handleRunMessage is awaiting runSketch(), creating a race with
   the subsequent clientState.runner.getSandboxStatus() call -
   producing 'Cannot read properties of null' errors.

   Fix: capture runner reference before the await gap so
   getSandboxStatus() always has a valid non-null reference.
root causes of Docker Desktop crash + E2E failures:
1. docker-compose unosim-server occupied port 3000 (restart: unless-stopped).
   lsof kill only removed docker-proxy, container kept running/restarting.
2. stale exited sandbox containers piled up across runs (8 found).
   cleanup only filtered by current ancestor image, missing old image IDs.
3. no container cleanup between Docker tests (74s) and E2E server start.
   Docker Desktop became overloaded and temporarily unresponsive.

fixes:
- add pre-flight section: checks node, docker, sonarqube, port 3000
- stop docker-compose unosim-server before tests (port 3000 conflict)
- find_sandbox_containers() helper: name + command-based matching catches
  containers from any image version (including unnamed/old-ID ones)
- clean stale containers in pre-flight and after Docker tests
- export FORCE_DOCKER=1 (not just inline) for reliable propagation
- docker recovery retry loop only when docker was available initially

proven: ./run-tests.sh passes all 7 steps + sonarqube quality gate
  1402 unit tests, 32 docker tests, 16 E2E tests, 0 issues
@ttbombadil ttbombadil merged commit c65435d into main Apr 8, 2026
3 checks passed
@ttbombadil ttbombadil deleted the ref branch April 8, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant