Merge pull request #65 from cloudskiff/fix_test_on_darwin

Fix test execution failed on darwin
main
Elie 2021-01-05 15:18:34 +01:00 committed by GitHub
commit e91b00d707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"runtime"
"testing"
"github.com/cloudskiff/driftctl/mocks"
@ -16,7 +17,7 @@ func TestProviderInstallerGetAwsDoesNotExist(t *testing.T) {
assert := assert.New(t)
fakeTmpHome := t.TempDir()
expectedSubFolder := "/.driftctl/plugins/linux_amd64"
expectedSubFolder := fmt.Sprintf("/.driftctl/plugins/%s_%s", runtime.GOOS, runtime.GOARCH)
fakeUrl := "https://example.com"
mockDownloader := mocks.ProviderDownloaderInterface{}
mockDownloader.On("GetProviderUrl", "aws", "3.19.0").Return(fakeUrl)
@ -40,7 +41,7 @@ func TestProviderInstallerGetAwsWithoutHomeDir(t *testing.T) {
assert := assert.New(t)
expectedHomeDir := os.TempDir()
expectedSubFolder := "/.driftctl/plugins/linux_amd64"
expectedSubFolder := fmt.Sprintf("/.driftctl/plugins/%s_%s", runtime.GOOS, runtime.GOARCH)
fakeUrl := "https://example.com"
mockDownloader := mocks.ProviderDownloaderInterface{}
mockDownloader.On("GetProviderUrl", "aws", "3.19.0").Return(fakeUrl)
@ -62,7 +63,7 @@ func TestProviderInstallerGetAwsAlreadyExist(t *testing.T) {
assert := assert.New(t)
fakeTmpHome := t.TempDir()
expectedSubFolder := "/.driftctl/plugins/linux_amd64"
expectedSubFolder := fmt.Sprintf("/.driftctl/plugins/%s_%s", runtime.GOOS, runtime.GOARCH)
err := os.MkdirAll(path.Join(fakeTmpHome, expectedSubFolder), 0755)
if err != nil {
t.Error(err)
@ -91,7 +92,7 @@ func TestProviderInstallerGetAwsAlreadyExistButIsDirectory(t *testing.T) {
assert := assert.New(t)
fakeTmpHome := t.TempDir()
expectedSubFolder := "/.driftctl/plugins/linux_amd64"
expectedSubFolder := fmt.Sprintf("/.driftctl/plugins/%s_%s", runtime.GOOS, runtime.GOARCH)
invalidDirPath := path.Join(fakeTmpHome, expectedSubFolder, awsProviderName)
err := os.MkdirAll(invalidDirPath, 0755)
if err != nil {