Skip to content

flake: Windows test compile error in enterprise/coderd/workspaces_test.go (undefined testutil.CacheTFProviders) #1119

@flake-investigator

Description

@flake-investigator

CI Run Link: https://github.com/coder/coder/actions/runs/19320202179

Commit Info:

  • SHA: f559e51d7f5dce823ac81da44153e03863d1dbcd
  • Author: Jake Howell
  • Commit: feat: add duration to the Request Logs details (#20756)

Summary:
Nightly gauntlet failed on Windows in job "test-go-pg (windows-2022)" due to a compile error in enterprise/coderd/workspaces_test.go. macOS job was cancelled as a consequence of the overall workflow failing. This is not a matrix cancellation artifact; the Windows job concluded with failure on run_attempt=1.

Key Error Evidence:

  • enterprise\coderd\workspaces_test.go:3403:28: undefined: testutil.CacheTFProviders

Relevant Log Excerpt:

=== Errors
enterprise\coderd\workspaces_test.go:3403:28: undefined: testutil.CacheTFProviders

DONE 12023 tests, 130 skipped, 2 failures, 1 error in 407.983s
Process completed with exit code 1.

Root Cause Classification: Code Change

  • The test helper enterprise/coderd/workspaces_test.go uses testutil.CacheTFProviders in function downloadProviders().
  • testutil/terraform_cache.go defines CacheTFProviders behind a build tag: //go:build linux || darwin, so it is not compiled on Windows. This causes an undefined symbol on Windows.

Code Evidence:

  • Reference in enterprise/coderd/workspaces_test.go:
    • Function starts at line 3395; call site around 3403:
    func downloadProviders(t *testing.T, providersTf string) string {
        t.Helper()
        cacheRootDir := filepath.Join(testutil.PersistentCacheDir(t), "terraform_workspace_tags_test")
        templateFiles := map[string]string{"providers.tf": providersTf}
        testName := "TestWorkspaceTagsTerraform"
        cliConfigPath := testutil.CacheTFProviders(t, cacheRootDir, testName, templateFiles)
        t.Logf("Set TF_CLI_CONFIG_FILE=%s", cliConfigPath)
        return cliConfigPath
    }
  • Definition of CacheTFProviders (non-Windows only): testutil/terraform_cache.go
    //go:build linux || darwin
    package testutil
    ...
    func CacheTFProviders(t *testing.T, rootDir string, testName string, templateFiles map[string]string) string { ... }

Precise Assignment Analysis:

  • Primary (test function blame): The failure occurs in helper function downloadProviders() within enterprise/coderd/workspaces_test.go. The most recent change to this function was introduced by commit f543a87b7871cbea2b9f23e1ac6a8a807608dafb ("chore: cache terraform providers for workspaces terraform tests (#20603)") authored by Kacper Sawicki. That commit replaces the previous in-test provider mirror logic with calls into testutil.CacheTFProviders and is responsible for introducing the Linux/Darwin-only helper usage into this file.
  • Diff reference: coder/coder@f543a87
    • It modifies lines ~3390–3407 in enterprise/coderd/workspaces_test.go to call testutil.CacheTFProviders.

Related Behavior in the Same Run:

  • There are also two test failures in scaletest workspace updates (e.g., TestRun) involving a 409 conflict ("A workspace build is already active."). Those appear secondary to the compile error and can be addressed separately if they persist; the compile error is deterministic on Windows and is the gating failure here.

Proposed Fix:

  • Provide a Windows-compatible implementation of the Terraform provider caching helper (e.g., add a Windows build of testutil/terraform_cache.go or a no-op shim with equivalent behavior on Windows), OR gate the usage in enterprise/coderd/workspaces_test.go behind OS-specific build tags to avoid invoking non-Windows helpers on Windows.

Reproduction:

  • On Windows, run the enterprise coderd tests that exercise downloadProviders():
    • go test ./enterprise/coderd -run TestWorkspaceTagsTerraform (or run the nightly job workflow on a Windows runner)
    • Observe compile error: undefined: testutil.CacheTFProviders

Duplicates Search:

  • Searched coder/internal for:
    • "CacheTFProviders"
    • "undefined: testutil.CacheTFProviders"
    • "windows tests compile undefined testutil"
  • No existing or closed issues found describing this failure.

Ownership Note:

  • Based on the primary assignment strategy (function-level blame), the change introducing the failing call was authored by Kacper Sawicki in #20603. Leaving unassigned; please triage to the appropriate owner (test infra/testutil or enterprise workspace tests) if Kacper is not the correct assignee.

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