mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-16 11:42:58 -06:00
internal/initwd: allow tests to pass when $PWD contains symlinks (#26015)
Fixes #26014
This commit is contained in:
parent
9699479601
commit
f63c38d6a1
@ -122,6 +122,17 @@ func TestDirFromModule_submodules(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DirFromModule will expand ("canonicalize") the pathnames, so we must do
|
||||||
|
// the same for our "wantCalls" comparison values. Otherwise this test
|
||||||
|
// will fail when building in a source tree with symlinks in $PWD.
|
||||||
|
//
|
||||||
|
// See also: https://github.com/hashicorp/terraform/issues/26014
|
||||||
|
//
|
||||||
|
fromModuleDirRealpath, err := filepath.EvalSymlinks(fromModuleDir)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
tmpDir, done := tempChdir(t, fixtureDir)
|
tmpDir, done := tempChdir(t, fixtureDir)
|
||||||
defer done()
|
defer done()
|
||||||
|
|
||||||
@ -138,12 +149,12 @@ func TestDirFromModule_submodules(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Name: "Install",
|
Name: "Install",
|
||||||
ModuleAddr: "child_a",
|
ModuleAddr: "child_a",
|
||||||
LocalPath: filepath.Join(fromModuleDir, "child_a"),
|
LocalPath: filepath.Join(fromModuleDirRealpath, "child_a"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "Install",
|
Name: "Install",
|
||||||
ModuleAddr: "child_a.child_b",
|
ModuleAddr: "child_a.child_b",
|
||||||
LocalPath: filepath.Join(fromModuleDir, "child_a/child_b"),
|
LocalPath: filepath.Join(fromModuleDirRealpath, "child_a/child_b"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user