@@ -217,61 +217,6 @@ func TestDependencyEmptyConfigPath_ReportsError(t *testing.T) {
217217 }
218218}
219219
220- // TestDisabledDependencyEmptyConfigPath_NoCycleError tests that disabled dependencies with empty
221- // config_path values do not cause cycle detection errors during discovery.
222- // This is a regression test for issue #4977 where setting enabled = false on a dependency
223- // with an empty config_path ("") was still causing terragrunt to throw cycle errors.
224- //
225- // The expected behavior is that disabled dependencies should be completely ignored during
226- // dependency graph construction and cycle detection, regardless of their config_path value.
227- //
228- // See: https://github.com/gruntwork-io/terragrunt/issues/4977
229- func TestDisabledDependencyEmptyConfigPath_NoCycleError (t * testing.T ) {
230- t .Parallel ()
231-
232- helpers .CleanupTerraformFolder (t , testFixtureDisabledDependencyEmptyConfigPath )
233- tmpEnvPath := helpers .CopyEnvironment (t , testFixtureDisabledDependencyEmptyConfigPath )
234- rootPath := util .JoinPath (tmpEnvPath , testFixtureDisabledDependencyEmptyConfigPath )
235- helpers .CreateGitRepo (t , rootPath )
236-
237- // Test 1: Run against unit-b which has disabled dependency with empty config_path
238- // This should NOT fail with cycle detection or empty config_path errors
239- unitBPath := util .JoinPath (rootPath , "unit-b" )
240- stdout , stderr , err := helpers .RunTerragruntCommandWithOutput (
241- t ,
242- "terragrunt plan --non-interactive --working-dir " + unitBPath ,
243- )
244-
245- // The command should succeed - disabled dependencies with empty paths should be ignored
246- require .NoError (t , err , "plan should succeed when disabled dependency has empty config_path" )
247-
248- // Should not see cycle detection errors
249- combinedOutput := stdout + stderr
250- assert .NotContains (t , combinedOutput , "cycle" ,
251- "Should not see cycle detection errors for disabled dependencies" )
252- assert .NotContains (t , combinedOutput , "Cycle detected" ,
253- "Should not see 'Cycle detected' error" )
254-
255- // Should not see empty config_path errors since the dependency is disabled
256- assert .NotContains (t , combinedOutput , "has empty config_path" ,
257- "Should not see empty config_path error for disabled dependency" )
258-
259- // Test 2: Also test run --all from the root to ensure discovery doesn't fail
260- _ , runAllStderr , runAllErr := helpers .RunTerragruntCommandWithOutput (
261- t ,
262- "terragrunt run --all plan --non-interactive --working-dir " + rootPath ,
263- )
264-
265- // run --all should also succeed
266- require .NoError (t , runAllErr , "run --all plan should succeed" )
267-
268- // Should not see cycle or graph-related errors during discovery
269- assert .NotContains (t , runAllStderr , "cycle" ,
270- "run --all should not see cycle errors" )
271- assert .NotContains (t , runAllStderr , "dependency graph" ,
272- "run --all should not see dependency graph errors" )
273- }
274-
275220// TestExposedIncludeWithDeprecatedInputsSyntax tests that deprecated dependency.*.inputs.* syntax
276221// is properly detected even when used in an included config with expose = true.
277222// This is a regression test for a bug introduced in v0.91.1 where the partial parse path
@@ -427,3 +372,50 @@ func TestSensitiveValues(t *testing.T) {
427372 assert .Equal (t , "25" , passwordLengthStr ,
428373 "Password length should match dev password" )
429374}
375+
376+ // TestDisabledDependencyEmptyConfigPath_NoCycleError tests that disabled dependencies with empty
377+ // config_path values do not cause cycle detection errors during discovery.
378+ // This is a regression test for issue #4977 where setting enabled = false on a dependency
379+ // with an empty config_path ("") was still causing terragrunt to throw cycle errors.
380+ //
381+ // The expected behavior is that disabled dependencies should be completely ignored during
382+ // dependency graph construction and cycle detection, regardless of their config_path value.
383+ //
384+ // See: https://github.com/gruntwork-io/terragrunt/issues/4977
385+ func TestDisabledDependencyEmptyConfigPath_NoCycleError (t * testing.T ) {
386+ t .Parallel ()
387+
388+ helpers .CleanupTerraformFolder (t , testFixtureDisabledDependencyEmptyConfigPath )
389+ tmpEnvPath := helpers .CopyEnvironment (t , testFixtureDisabledDependencyEmptyConfigPath )
390+ rootPath := util .JoinPath (tmpEnvPath , testFixtureDisabledDependencyEmptyConfigPath )
391+ helpers .CreateGitRepo (t , rootPath )
392+
393+ unitBPath := util .JoinPath (rootPath , "unit-b" )
394+ stdout , stderr , err := helpers .RunTerragruntCommandWithOutput (
395+ t ,
396+ "terragrunt plan --non-interactive --working-dir " + unitBPath ,
397+ )
398+
399+ require .NoError (t , err , "plan should succeed when disabled dependency has empty config_path" )
400+
401+ combinedOutput := stdout + stderr
402+ assert .NotContains (t , combinedOutput , "cycle" ,
403+ "Should not see cycle detection errors for disabled dependencies" )
404+ assert .NotContains (t , combinedOutput , "Cycle detected" ,
405+ "Should not see 'Cycle detected' error" )
406+
407+ assert .NotContains (t , combinedOutput , "has empty config_path" ,
408+ "Should not see empty config_path error for disabled dependency" )
409+
410+ _ , runAllStderr , runAllErr := helpers .RunTerragruntCommandWithOutput (
411+ t ,
412+ "terragrunt run --all plan --non-interactive --working-dir " + rootPath ,
413+ )
414+
415+ require .NoError (t , runAllErr , "run --all plan should succeed" )
416+
417+ assert .NotContains (t , runAllStderr , "cycle" ,
418+ "run --all should not see cycle errors" )
419+ assert .NotContains (t , runAllStderr , "dependency graph" ,
420+ "run --all should not see dependency graph errors" )
421+ }
0 commit comments