Skip to content

flake: TestGetModulesArchive (multiple variants, Windows) #1325

@flake-investigator

Description

@flake-investigator

CI Run Link: https://github.com/coder/coder/actions/runs/21617155575
Job: test-go-pg (windows-2022)
Commit: b8b8387b277d333718ecbd6fbe068547a9e94dc9 (Dean Sheather) coder/coder@b8b8387

Failure:

=== FAIL: provisioner/terraform TestGetModulesArchive/PackingMultipleSkipped (0.00s)
    modules_internal_test.go:232:
        Error: "[]" should have 3 item(s), but has 0
        Messages: all three large modules should be skipped

=== FAIL: provisioner/terraform TestGetModulesArchive/PackingEdgeCaseExactFit (0.00s)
    modules_internal_test.go:208:
        Error: Received unexpected error:
            failed to write modules.json to archive:
              github.com/coder/coder/v2/provisioner/terraform.GetModulesArchiveWithLimit
                provisioner/terraform/modules.go:194
              - i/o limit reached:
                github.com/coder/coder/v2/coderd/util/xio.init
                  coderd/util/xio/limitwriter.go:9

=== FAIL: provisioner/terraform TestGetModulesArchive/PackingAllFit (0.00s)
    modules_internal_test.go:159:
        Error: Received unexpected error:
            open .terraform/modules/mod1/payload: The system cannot find the file specified.

Root cause assessment:

  • Windows path separator mismatch. moduleArchiveFS uses filepath.Join, which stores module Dir entries with backslashes (e.g., .terraform\modules\mod1) in modules.json. GetModulesArchiveWithLimit checks strings.HasPrefix(it.Dir, ".terraform/modules/"), so Windows module dirs fail the prefix check and are skipped entirely. This leaves the archive empty (skipped list length 0, module payloads missing), and in the exact-fit test results in actualSize being 0, which triggers the i/o limit reached error when writing modules.json.
  • Suggestion: normalize module paths with filepath.ToSlash(it.Dir) before prefix checks (and/or compare using filepath.Clean + OS-aware prefix), so Windows dirs are recognized.

Assignment analysis:

  • git log --oneline -10 --follow provisioner/terraform/modules_internal_test.go
    • 956e123d9680 test: fix flakiness around tar block size in test (#21854) (Steven Masley / @Emyrk)
    • 6b3d4377c3a5 feat: archive modules in size order until limit is hit (#21773) (Steven Masley / @Emyrk)
  • git log --oneline -10 --follow provisioner/terraform/modules.go
    • 6b3d4377c3a5 feat: archive modules in size order until limit is hit (#21773) (Steven Masley / @Emyrk)

Related issues:

Reproduction:

  • Run on Windows: go test ./provisioner/terraform -run TestGetModulesArchive

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions