diff --git a/Makefile b/Makefile index bf9e3d304c..6d7978771c 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,10 @@ test-update: test-update-templates: -go test ./acceptance -run '^TestAccept/bundle/templates' -update -timeout=${LOCAL_TIMEOUT} +# Regenerate out.test.toml files without running tests +generate-out-test-toml: + go test ./acceptance -run '^TestAccept$$' -only-out-test-toml -timeout=${LOCAL_TIMEOUT} + # Updates acceptance test output (integration tests, requires access) test-update-aws: deco env run -i -n aws-prod-ucws -- go test ./acceptance -run ^TestAccept$$ -update -timeout=1h -skiplocal -v @@ -167,7 +171,7 @@ generate: $(GENKIT_BINARY) update-sdk -.PHONY: lint lintfull tidy lintcheck fmt fmtfull test test-unit test-acc test-slow test-slow-unit test-slow-acc cover showcover build snapshot snapshot-release schema integration integration-short acc-cover acc-showcover docs ws wsfix links checks test-update test-update-templates test-update-aws test-update-all generate-validation +.PHONY: lint lintfull tidy lintcheck fmt fmtfull test test-unit test-acc test-slow test-slow-unit test-slow-acc cover showcover build snapshot snapshot-release schema integration integration-short acc-cover acc-showcover docs ws wsfix links checks test-update test-update-templates generate-out-test-toml test-update-aws test-update-all generate-validation test-exp-aitools: make test TEST_PACKAGES="./experimental/aitools/..." ACCEPTANCE_TEST_FILTER="TestAccept/idontexistyet/aitools" diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 0f905348d4..e47154a6b3 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -48,6 +48,7 @@ var ( UseVersion string WorkspaceTmpDir bool TerraformDir string + OnlyOutTestToml bool ) // In order to debug CLI running under acceptance test, search for TestInprocessMode and update @@ -78,6 +79,7 @@ func init() { // creates these symlinks when a file_mirror is used for a provider (in .terraformrc). This flag // allows us to download the provider to the workspace file system on DBR enabling DBR integration testing. flag.StringVar(&TerraformDir, "terraform-dir", "", "Directory to download the terraform provider to") + flag.BoolVar(&OnlyOutTestToml, "only-out-test-toml", false, "Only regenerate out.test.toml files without running tests") } const ( @@ -307,7 +309,7 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int { config, configPath := internal.LoadConfig(t, dir) skipReason := getSkipReason(&config, configPath) - if testdiff.OverwriteMode { + if testdiff.OverwriteMode || OnlyOutTestToml { // Generate materialized config for this test // We do this before skipping the test, so the configs are generated for all tests. materializedConfig, err := internal.GenerateMaterializedConfig(config) @@ -315,6 +317,11 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int { testutil.WriteFile(t, filepath.Join(dir, internal.MaterializedConfigFile), materializedConfig) } + // If only regenerating out.test.toml, skip the actual test execution + if OnlyOutTestToml { + t.Skip("Skipping test execution (only regenerating out.test.toml)") + } + if skipReason != "" { skippedDirs += 1 t.Skip(skipReason)