From e48eb6ff501c585dd8b18eb3ce9c87ac897a6407 Mon Sep 17 00:00:00 2001 From: Kartik Gupta <88345179+kartikgupta-db@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:32:02 +0100 Subject: [PATCH] Fix integration tests for windows (#165) Successful run: Azure: https://github.com/databricks/eng-dev-ecosystem/actions/runs/3892131225 AWS: https://github.com/databricks/eng-dev-ecosystem/actions/runs/3892432562 --- internal/api_test.go | 4 ++-- internal/locker_test.go | 21 ++------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/internal/api_test.go b/internal/api_test.go index 190f9654..342083fc 100644 --- a/internal/api_test.go +++ b/internal/api_test.go @@ -3,7 +3,7 @@ package internal import ( "encoding/json" "fmt" - "path/filepath" + "path" "testing" "github.com/stretchr/testify/assert" @@ -34,7 +34,7 @@ func TestAccApiPost(t *testing.T) { t.Skip("DBFS REST API is disabled on gcp") } - dbfsPath := filepath.Join("/tmp/bricks/integration", RandomName("api-post")) + dbfsPath := path.Join("/tmp/bricks/integration", RandomName("api-post")) requestPath := writeFile(t, "body.json", fmt.Sprintf(`{ "path": "%s" }`, dbfsPath)) diff --git a/internal/locker_test.go b/internal/locker_test.go index c919a84b..058f0d78 100644 --- a/internal/locker_test.go +++ b/internal/locker_test.go @@ -5,9 +5,6 @@ import ( "encoding/json" "fmt" "math/rand" - "os" - "os/exec" - "path/filepath" "sync" "testing" "time" @@ -43,25 +40,11 @@ func createRemoteTestProject(t *testing.T, projectNamePrefix string, wsc *databr return remoteProjectRoot } -func createLocalTestProject(t *testing.T) string { - tempDir := t.TempDir() - - cmd := exec.Command("git", "clone", EmptyRepoUrl) - cmd.Dir = tempDir - err := cmd.Run() - assert.NoError(t, err) - - localProjectRoot := filepath.Join(tempDir, "empty-repo") - err = os.Chdir(localProjectRoot) - assert.NoError(t, err) - return localProjectRoot -} - func TestAccLock(t *testing.T) { t.Log(GetEnvOrSkipTest(t, "CLOUD_ENV")) ctx := context.TODO() - wsc := databricks.Must(databricks.NewWorkspaceClient()) - createLocalTestProject(t) + wsc, err := databricks.NewWorkspaceClient() + require.NoError(t, err) remoteProjectRoot := createRemoteTestProject(t, "lock-acc-", wsc) // 50 lockers try to acquire a lock at the same time