From 69b6791ef17f75bc2f5eb997097cb2452f857a2c Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Wed, 25 Sep 2019 16:27:17 -0400 Subject: [PATCH] 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. --- internal/initwd/from_module_test.go | 6 +++++- internal/initwd/module_install_test.go | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/internal/initwd/from_module_test.go b/internal/initwd/from_module_test.go index 480ead680..b467552b5 100644 --- a/internal/initwd/from_module_test.go +++ b/internal/initwd/from_module_test.go @@ -19,7 +19,11 @@ func TestDirFromModule_registry(t *testing.T) { } 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") defer done() diff --git a/internal/initwd/module_install_test.go b/internal/initwd/module_install_test.go index 27a82aef7..786f84400 100644 --- a/internal/initwd/module_install_test.go +++ b/internal/initwd/module_install_test.go @@ -232,7 +232,12 @@ func TestLoaderInstallModules_registry(t *testing.T) { } 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() hooks := &testInstallHooks{} @@ -359,7 +364,11 @@ func TestLoaderInstallModules_goGetter(t *testing.T) { } 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() hooks := &testInstallHooks{}