Kartik Gupta 2023-01-11 13:32:02 +01:00 committed by GitHub
parent bf9f0c06b0
commit e48eb6ff50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 21 deletions

View File

@ -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))

View File

@ -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