MCPcopy Index your code
hub / github.com/coder/coder / GetTestTFCacheDir

Function GetTestTFCacheDir

testutil/terraform_cache.go:105–111  ·  view source on GitHub ↗

GetTestTFCacheDir returns a unique cache directory path based on the test name and template files. Each test gets a unique cache dir based on its name and template files. This ensures that tests can download providers in parallel and that they will redownload providers if the template files change.

(t *testing.T, rootDir string, testName string, templateFiles map[string]string)

Source from the content-addressed store, hash-verified

103// This ensures that tests can download providers in parallel and that they
104// will redownload providers if the template files change.
105func GetTestTFCacheDir(t *testing.T, rootDir string, testName string, templateFiles map[string]string) string {
106 t.Helper()
107
108 hash := hashTemplateFilesAndTestName(t, testName, templateFiles)
109 dir := filepath.Join(rootDir, hash[:12])
110 return dir
111}
112
113// DownloadTFProviders ensures Terraform providers are downloaded and cached locally in a unique directory for the test.
114// Uses `terraform init` then `mirror` to populate the cache if needed.

Callers 2

TestProvisionFunction · 0.92
DownloadTFProvidersFunction · 0.85

Calls 2

HelperMethod · 0.65

Tested by 1

TestProvisionFunction · 0.74