internal/initwd: fix issues with tests and symlinks

filepath.EvalSymlinks is our friend! The code already does this, the
tests needed to be updated to do the same.
This commit is contained in:
Kristin Laemmert 2019-09-25 16:27:17 -04:00
parent d7ed4b0605
commit 69b6791ef1
2 changed files with 16 additions and 3 deletions

View File

@ -19,7 +19,11 @@ func TestDirFromModule_registry(t *testing.T) {
} }
fixtureDir := filepath.Clean("testdata/empty") fixtureDir := filepath.Clean("testdata/empty")
dir, done := tempChdir(t, fixtureDir) tmpDir, done := tempChdir(t, fixtureDir)
dir, err := filepath.EvalSymlinks(tmpDir)
if err != nil {
t.Error(err)
}
modsDir := filepath.Join(dir, ".terraform/modules") modsDir := filepath.Join(dir, ".terraform/modules")
defer done() defer done()

View File

@ -232,7 +232,12 @@ func TestLoaderInstallModules_registry(t *testing.T) {
} }
fixtureDir := filepath.Clean("testdata/registry-modules") fixtureDir := filepath.Clean("testdata/registry-modules")
dir, done := tempChdir(t, fixtureDir) tmpDir, done := tempChdir(t, fixtureDir)
dir, err := filepath.EvalSymlinks(tmpDir)
if err != nil {
t.Error(err)
}
defer done() defer done()
hooks := &testInstallHooks{} hooks := &testInstallHooks{}
@ -359,7 +364,11 @@ func TestLoaderInstallModules_goGetter(t *testing.T) {
} }
fixtureDir := filepath.Clean("testdata/go-getter-modules") fixtureDir := filepath.Clean("testdata/go-getter-modules")
dir, done := tempChdir(t, fixtureDir) tmpDir, done := tempChdir(t, fixtureDir)
dir, err := filepath.EvalSymlinks(tmpDir)
if err != nil {
t.Error(err)
}
defer done() defer done()
hooks := &testInstallHooks{} hooks := &testInstallHooks{}