Skip to content

Commit 1dff515

Browse files
committed
chore: Adding racing test
1 parent 9e36250 commit 1dff515

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

internal/runner/run/download_source.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"strings"
1111
"sync"
1212

13-
1413
"github.com/hashicorp/go-getter"
1514
getterv2 "github.com/hashicorp/go-getter/v2"
1615

test/integration_regressions_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,28 @@ func TestReadTerragruntConfigDependencyInStack(t *testing.T) {
735735
"read_terragrunt_config should be able to parse dependency blocks during stack runs")
736736
}
737737

738+
// TestReadTerragruntConfigDependencyInStackWithRacing exercises the same scenario
739+
// as TestReadTerragruntConfigDependencyInStack under the race detector.
740+
// The `run --all` command internally processes units concurrently, which is
741+
// sufficient to trigger races in the download/cache path.
742+
// The CI "Race" job runs tests matching .*WithRacing with -race.
743+
func TestReadTerragruntConfigDependencyInStackWithRacing(t *testing.T) {
744+
t.Parallel()
745+
746+
helpers.CleanupTerraformFolder(t, testFixtureReadConfigDependencyStack)
747+
tmpEnvPath := helpers.CopyEnvironment(t, testFixtureReadConfigDependencyStack)
748+
rootPath := filepath.Join(tmpEnvPath, testFixtureReadConfigDependencyStack)
749+
750+
_, stderr, err := helpers.RunTerragruntCommandWithOutput(
751+
t,
752+
"terragrunt run --all plan --non-interactive --working-dir "+rootPath,
753+
)
754+
require.NoError(t, err)
755+
756+
assert.NotContains(t, stderr, "\"dependency\" is not defined",
757+
"read_terragrunt_config should be able to parse dependency blocks during stack runs")
758+
}
759+
738760
// TestChainedDepsExposedIncludeNoErrorLog verifies that chaining dependencies with exposed
739761
// includes does not produce spurious ERROR-level log messages.
740762
// This is a regression test for https://github.com/gruntwork-io/terragrunt/issues/4153

0 commit comments

Comments
 (0)