Skip to content

Commit 688946c

Browse files
Add -only-out-test-toml flag (#3881)
## Summary This PR: 1. Adds a new flag to the acceptance test framework that allows regenerating `out.test.toml` configuration files without running the actual tests, making it much faster to update test configurations. ## Usage ### Using Make target (recommended) ```bash make generate-out-test-toml ```
1 parent 700366b commit 688946c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ test-update:
8787
test-update-templates:
8888
-go test ./acceptance -run '^TestAccept/bundle/templates' -update -timeout=${LOCAL_TIMEOUT}
8989

90+
# Regenerate out.test.toml files without running tests
91+
generate-out-test-toml:
92+
go test ./acceptance -run '^TestAccept$$' -only-out-test-toml -timeout=${LOCAL_TIMEOUT}
93+
9094
# Updates acceptance test output (integration tests, requires access)
9195
test-update-aws:
9296
deco env run -i -n aws-prod-ucws -- go test ./acceptance -run ^TestAccept$$ -update -timeout=1h -skiplocal -v
@@ -167,7 +171,7 @@ generate:
167171
$(GENKIT_BINARY) update-sdk
168172

169173

170-
.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
174+
.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
171175

172176
test-exp-aitools:
173177
make test TEST_PACKAGES="./experimental/aitools/..." ACCEPTANCE_TEST_FILTER="TestAccept/idontexistyet/aitools"

acceptance/acceptance_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var (
4848
UseVersion string
4949
WorkspaceTmpDir bool
5050
TerraformDir string
51+
OnlyOutTestToml bool
5152
)
5253

5354
// In order to debug CLI running under acceptance test, search for TestInprocessMode and update
@@ -78,6 +79,7 @@ func init() {
7879
// creates these symlinks when a file_mirror is used for a provider (in .terraformrc). This flag
7980
// allows us to download the provider to the workspace file system on DBR enabling DBR integration testing.
8081
flag.StringVar(&TerraformDir, "terraform-dir", "", "Directory to download the terraform provider to")
82+
flag.BoolVar(&OnlyOutTestToml, "only-out-test-toml", false, "Only regenerate out.test.toml files without running tests")
8183
}
8284

8385
const (
@@ -307,14 +309,19 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
307309
config, configPath := internal.LoadConfig(t, dir)
308310
skipReason := getSkipReason(&config, configPath)
309311

310-
if testdiff.OverwriteMode {
312+
if testdiff.OverwriteMode || OnlyOutTestToml {
311313
// Generate materialized config for this test
312314
// We do this before skipping the test, so the configs are generated for all tests.
313315
materializedConfig, err := internal.GenerateMaterializedConfig(config)
314316
require.NoError(t, err)
315317
testutil.WriteFile(t, filepath.Join(dir, internal.MaterializedConfigFile), materializedConfig)
316318
}
317319

320+
// If only regenerating out.test.toml, skip the actual test execution
321+
if OnlyOutTestToml {
322+
t.Skip("Skipping test execution (only regenerating out.test.toml)")
323+
}
324+
318325
if skipReason != "" {
319326
skippedDirs += 1
320327
t.Skip(skipReason)

0 commit comments

Comments
 (0)