Skip to content

debug: add workflow to investigate flaky layer ordering tests - #1

Merged
bnusunny merged 3 commits into
developfrom
aws-sam-cli-tests
Feb 11, 2026
Merged

debug: add workflow to investigate flaky layer ordering tests#1
bnusunny merged 3 commits into
developfrom
aws-sam-cli-tests

Conversation

@bnusunny

Copy link
Copy Markdown
Owner

Problem

The test_download_two_layers integration tests are flaky on Docker (but pass on Finch). They consistently return "Layer1" instead of "Layer2", suggesting a layer ordering/overlay issue specific to Docker daemon.

Changes

  • Add a manually-triggered (workflow_dispatch) GitHub Actions workflow that runs the TestLayerVersion class with debug instrumentation
  • Instrumentation script patches SAM CLI source at runtime to log layer ordering at every stage

What the debug workflow captures

  • Layer ordering in download_all() input/output
  • Per-layer download decisions (cached vs fresh)
  • Extracted layer file contents after download
  • Generated Dockerfile ADD command sequence
  • Tarball construction order
  • Docker build stream output (cache hits)
  • Image build vs reuse decisions

How to use

Once merged, trigger from Actions tab -> Debug Layer Order Tests -> Run workflow.

Add a manually-triggered GitHub Actions workflow that runs
test_download_two_layers 5 times with debug instrumentation
to diagnose why layers sometimes return 'Layer1' instead of
'Layer2' on Docker (but not Finch).

Instrumentation logs:
- Layer ordering in download_all() input/output
- Generated Dockerfile ADD command sequence
- Tarball construction order
- Image build vs reuse decisions
Instead of running isolated iterations, run the exact same pytest
command as the CI local-invoke suite with added debug logging.
This reproduces the real test ordering and cross-test interactions.

Enhanced instrumentation now also captures:
- Per-layer download decisions (cached vs fresh)
- Extracted layer file contents after download
- Docker build stream output (cache hits show as CACHED)
Run just the TestLayerVersion class instead of the full local-invoke
suite. This covers the failing test_download_two_layers plus the
other tests in the class that may cause cross-test contamination.
@bnusunny
bnusunny merged commit 5766c7d into develop Feb 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant