internal: Fix providercache test failures on macOS

For reasons that are unclear, these two tests just started failing on
macOS very recently. The failure looked like:

    PackageDir: strings.Join({
      "/",
+     "private/",
      "var/folders/3h/foobar/T/terraform-test-p",
      "rovidercache655312854/registry.terraform.io/hashicorp/null/2.0.0",
      "/windows_amd64",
    },

Speculating that the macOS temporary directory moved into the /private
directory, I added a couple of EvalSymlinks calls and the tests pass
again.

No other unit tests appear to be affected by this at the moment.
This commit is contained in:
Alisdair McDiarmid 2020-09-04 16:09:57 -04:00
parent 883e4487a2
commit 5587509bcf
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/apparentlymart/go-versions/versions"
@ -19,6 +20,10 @@ func TestInstallPackage(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(tmpDirPath)
tmpDirPath, err = filepath.EvalSymlinks(tmpDirPath)
if err != nil {
t.Fatal(err)
}
linuxPlatform := getproviders.Platform{
OS: "linux",
@ -74,6 +79,10 @@ func TestLinkFromOtherCache(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(tmpDirPath)
tmpDirPath, err = filepath.EvalSymlinks(tmpDirPath)
if err != nil {
t.Fatal(err)
}
windowsPlatform := getproviders.Platform{
OS: "windows",