-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: Verify --queue-include-external isn't necessary when using the --filter flag
#5216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,47 @@ func TestTerragruntWorksWithIncludeLocals(t *testing.T) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func TestTerragruntWorksWithIncludeLocalsWithFilter(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.Parallel() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if !helpers.IsExperimentMode(t) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.Skip("Skipping filter flag tests - TG_EXPERIMENT_MODE not enabled") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helpers.CleanupTerraformFolder(t, includeExposeFixturePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tmpEnvPath := helpers.CopyEnvironment(t, includeExposeFixturePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tmpEnvPath = util.JoinPath(tmpEnvPath, includeExposeFixturePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| files, err := os.ReadDir(tmpEnvPath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| require.NoError(t, err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testCases := []string{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, finfo := range files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if finfo.IsDir() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| testCases = append(testCases, finfo.Name()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, tc := range testCases { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.Run(filepath.Base(tc), func(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.Parallel() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| childPath := filepath.Join(tmpEnvPath, tc, includeChildFixturePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helpers.CleanupTerraformFolder(t, childPath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| helpers.RunTerragrunt(t, "terragrunt run --all --filter '{./**}...' --non-interactive --log-level trace --working-dir "+childPath+" -- apply -auto-approve") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stdout := bytes.Buffer{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stderr := bytes.Buffer{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| err := helpers.RunTerragruntCommand(t, "terragrunt output -no-color -json --non-interactive --log-level trace --working-dir "+childPath, &stdout, &stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| require.NoError(t, err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs := map[string]helpers.TerraformOutput{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| require.NoError(t, json.Unmarshal(stdout.Bytes(), &outputs)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert.Equal(t, "us-west-1-test", outputs["region"].Value.(string)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+68
to
+108
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find the RunTerragruntCommandWithOutputWithContext function
echo "=== Searching for RunTerragruntCommandWithOutputWithContext ==="
rg -n "func RunTerragruntCommandWithOutputWithContext\(" test/helpers -A 10
echo -e "\n=== Searching for shell command parsing patterns ==="
rg -n "shellwords|sh -c|bash -c|strings\.Fields|Split\(" test/helpers -B 2 -A 2
echo -e "\n=== Checking CleanupTerraformFolder implementation ==="
rg -n "func CleanupTerraformFolder" test/helpers -A 10
echo -e "\n=== Checking other similar test patterns in integration_include_test.go ==="
rg -n "helpers.CleanupTerraformFolder" test/integration_include_test.go -B 3 -A 3Repository: gruntwork-io/terragrunt Length of output: 5916 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Finding CopyEnvironment implementation ==="
rg -n "func CopyEnvironment" test/helpers -A 15
echo -e "\n=== Understanding what includeExposeFixturePath, tmpEnvPath point to ==="
rg -n "includeExposeFixturePath\|includeChildFixturePath" test/integration_include_test.go -B 2 -A 2 | head -40
echo -e "\n=== Check the fixture path definitions at top of file ==="
head -30 test/integration_include_test.goRepository: gruntwork-io/terragrunt Length of output: 1069 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== File header with fixture path definitions ==="
head -30 test/integration_include_test.go
echo -e "\n=== Full context of the test function ==="
sed -n '68,110p' test/integration_include_test.goRepository: gruntwork-io/terragrunt Length of output: 2427 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Checking for t.Parallel() calls in related tests ==="
rg -n "func Test.*IncludeLocals" test/integration_include_test.go -A 3
echo -e "\n=== Verifying the issue: both tests clean shared fixture while running in parallel ==="
echo "TestTerragruntWorksWithIncludeLocals:"
sed -n '31,36p' test/integration_include_test.go
echo ""
echo "TestTerragruntWorksWithIncludeLocalsWithFilter:"
sed -n '68,77p' test/integration_include_test.goRepository: gruntwork-io/terragrunt Length of output: 1234 Move cleanup from repo fixture to temp copy to avoid parallel test interference. Both - helpers.CleanupTerraformFolder(t, includeExposeFixturePath)
tmpEnvPath := helpers.CopyEnvironment(t, includeExposeFixturePath)
tmpEnvPath = util.JoinPath(tmpEnvPath, includeExposeFixturePath)
+ helpers.CleanupTerraformFolder(t, tmpEnvPath)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func TestTerragruntRunAllModulesThatIncludeRestrictsSet(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.Parallel() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 995
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4559
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1977
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 6014
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 6175
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2094
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3592
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 6093
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1303
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3584
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2596
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1948
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1862
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3876
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 5159
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4409
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2735
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4349
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3952
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 6099
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1644
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2014
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1462
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 869
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 252
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 1632
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3961
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 7086
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2674
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 2333
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 8078
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 127
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 10461
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 993
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 6195
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4327
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 9321
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 797
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4266
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3515
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3440
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4118
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 7264
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 604
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 7667
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 7247
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 4407
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 3381
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 7184
🏁 Script executed:
Repository: gruntwork-io/terragrunt
Length of output: 359
Move fixture cleanup to copied environment to prevent race conditions; replace
t.Errorfwithrequire.NoErrorto fail fast.The test cleans the repository fixture (
testFixtureExternalDependence) before copying the environment. Witht.Parallel(), this creates a race condition as other tests may access the same shared fixture path. Move cleanup operations afterCopyEnvironmentto operate only on the isolated copy. Additionally, replacet.Errorfwithrequire.NoErrorto fail immediately on command errors instead of allowing subsequent assertions to run with invalid data.func TestTerragruntExternalDependenciesWithFilter(t *testing.T) { t.Parallel() if !helpers.IsExperimentMode(t) { t.Skip("Skipping filter flag tests - TG_EXPERIMENT_MODE not enabled") } modules := []string{ "module-a", "module-b", } - helpers.CleanupTerraformFolder(t, testFixtureExternalDependence) - - for _, module := range modules { - helpers.CleanupTerraformFolder(t, util.JoinPath(testFixtureExternalDependence, module)) - } - var ( applyAllStdout bytes.Buffer applyAllStderr bytes.Buffer ) rootPath := helpers.CopyEnvironment(t, testFixtureExternalDependence) - modulePath := util.JoinPath(rootPath, testFixtureExternalDependence, "module-b") + fixtureRoot := util.JoinPath(rootPath, testFixtureExternalDependence) + helpers.CleanupTerraformFolder(t, fixtureRoot) + for _, module := range modules { + helpers.CleanupTerraformFolder(t, util.JoinPath(fixtureRoot, module)) + } + modulePath := util.JoinPath(fixtureRoot, "module-b") err := helpers.RunTerragruntCommand(t, "terragrunt run --all apply --non-interactive --filter '{./**}...' --tf-forward-stdout --working-dir "+modulePath, &applyAllStdout, &applyAllStderr) helpers.LogBufferContentsLineByLine(t, applyAllStdout, "run --all apply stdout") helpers.LogBufferContentsLineByLine(t, applyAllStderr, "run --all apply stderr") + require.NoError(t, err) applyAllStdoutString := applyAllStdout.String() - - if err != nil { - t.Errorf("Did not expect to get error: %s", err.Error()) - } for _, module := range modules { assert.Contains(t, applyAllStdoutString, "Hello World, "+module) } }🤖 Prompt for AI Agents