Skip to content

tests: TestConvertStateGolden fails on Windows (undefined: updateGoldenFiles) #1141

Closed
coder/coder
#20901

Description

@flake-investigator

CI Run: https://github.com/coder/coder/actions/runs/19623117684
Commit: a6581c71579dd1e87aec9f953e7e936ea7b19fe0 (Rowan Smith)
Workflow/job: nightly-gauntlet / test-go-pg (windows-2022)
When: 2025-11-24 ~04:26 UTC (same day as this alert)

Failure summary:

github.com/coder/coder/v2/provisioner/terraform_test [github.com/coder/coder/v2/provisioner/terraform.test]

provisioner\terraform\resources_test.go:124:9: undefined: updateGoldenFiles

Root cause assessment:

  • Category: Code change / test scaffolding (not infrastructure, not data race, not process crash)
  • resources_test.go (TestConvertStateGolden) references *updateGoldenFiles.
  • updateGoldenFiles is only defined in provisioner/terraform/cleanup_test.go which has a platform build tag: //go:build linux || darwin.
  • On Windows, cleanup_test.go is excluded, so the symbol is undefined when compiling resources_test.go.

Evidence:

  • resources_test.go (around line 124):
    if *updateGoldenFiles {
    gotBytes, err := json.MarshalIndent(...)
    ...
    }
  • cleanup_test.go top of file contains: //go:build linux || darwin
  • cleanup_test.go defines: var updateGoldenFiles = flag.Bool("update", false, "Update golden files")

Precise assignment analysis:

  • Failing test function: TestConvertStateGolden in provisioner/terraform/resources_test.go
  • Recent change adding this test: a61b8bc5cee008622f5035f706eb58f0bb4e0b9a ("test: add golden file test for ConvertState (#20832)") by Steven Masley (@Emyrk)
  • The failure is due to missing test flag definition on Windows, introduced with the new test referencing updateGoldenFiles. Assigning to @Emyrk as the last modifier of the failing test function.

Proposed fix direction:

  • Provide a Windows-visible definition of updateGoldenFiles (e.g., move the flag to a common *_test.go file without build tags, or add a windows-specific *_test.go that declares the flag), or guard the reference in resources_test.go behind a platform check.

Reproduction:

  • Repro on Windows: go test ./provisioner/terraform or GOOS=windows GOARCH=amd64 go test ./provisioner/terraform
  • CI context: Run link above; failing job: test-go-pg (windows-2022)

Duplicate search performed (no matches found):

  • repo:coder/internal "undefined: updateGoldenFiles"
  • repo:coder/internal "TestConvertStateGolden"
  • repo:coder/internal resources_test.go updateGoldenFiles

Classification: Code Change / test failure on Windows due to platform-limited flag definition.

Activity

  1. changed the title [-]flake: TestConvertStateGolden fails on Windows (undefined: updateGoldenFiles)[/-] [+]tests: TestConvertStateGolden fails on Windows (undefined: updateGoldenFiles)[/+] on Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions