mirror of https://github.com/hashicorp/terraform
test: Update `TestInit_fromModule_dstInSrc` to reflect current behaviour when -from-module references the location of the current directory (#38059)
* test: Update `TestInit_fromModule_dstInSrc` to use modern `t.Chdir` approach, add context through comments
* test: Add context about how `TestInit_fromModule_dstInSrc` has been refactored since it was first created
Originally the test's args were []string{".", "foo"} (https://github.com/hashicorp/terraform/pull/547), where the second arg is the directory TF should use as the root directory. Then the test was changed to use []string{"-from-module=.", "foo"} when the -from-module flag was added in 8a7a0a7459. Finally, the second arg was removed in https://github.com/hashicorp/terraform/pull/27664, and replaced with the use of os.Chdir in this test.
* test: Update `TestInit_fromModule_dstInSrc` to define the new behavior of -from-module in this scenario; the current directory is copied once, but not recursively.
If you run this test from commit 84f5b863ef with a debugger we can see that foo is never copied into the current directory foo (./foo/foo is never made). Now, after refactoring ./foo/foo IS made, but it's not copied recursively like in the original issue.
* docs: Add comment about emergent behavior when using -chdir with -from-module in this scenario
pull/38063/head
parent
1186262c8c
commit
827f693e32
Loading…
Reference in new issue