This commit is contained in:
Shreyas Goenka 2023-06-02 00:15:02 +02:00
parent c1ccf8204f
commit efc72b5bbd
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
4 changed files with 8 additions and 9 deletions

View File

@ -148,7 +148,7 @@ func setupWorkspaceFilesTest(t *testing.T) (context.Context, filer.Filer) {
ctx := context.Background()
w := databricks.Must(databricks.NewWorkspaceClient())
tmpdir := TemporaryWorkspaceDir(t, w)
tmpdir := temporaryWorkspaceDir(t, w)
f, err := filer.NewWorkspaceFilesClient(w, tmpdir)
require.NoError(t, err)

View File

@ -180,7 +180,7 @@ func writeFile(t *testing.T, name string, body string) string {
return f.Name()
}
func TemporaryWorkspaceDir(t *testing.T, w *databricks.WorkspaceClient) string {
func temporaryWorkspaceDir(t *testing.T, w *databricks.WorkspaceClient) string {
ctx := context.Background()
me, err := w.CurrentUser.Me(ctx)
require.NoError(t, err)

View File

@ -20,7 +20,7 @@ func TestWorkspaceImportDir(t *testing.T) {
ctx := context.Background()
w := databricks.Must(databricks.NewWorkspaceClient())
tmpdir := TemporaryWorkspaceDir(t, w)
tmpdir := temporaryWorkspaceDir(t, w)
// run import_dir command
RequireSuccessfulRun(t, "workspace", "import_dir", "./testdata/import_dir/default", tmpdir)
@ -39,7 +39,7 @@ func TestWorkspaceImportDirOverwriteFlag(t *testing.T) {
// ctx := context.Background()
w := databricks.Must(databricks.NewWorkspaceClient())
tmpdir := TemporaryWorkspaceDir(t, w)
tmpdir := temporaryWorkspaceDir(t, w)
// run import_dir command
RequireSuccessfulRun(t, "workspace", "import_dir", "./testdata/import_dir/override/a", tmpdir)
@ -49,7 +49,6 @@ func TestWorkspaceImportDirOverwriteFlag(t *testing.T) {
// require.NoError(t, err)
// assertFileContains(t, ctx, f, "bar.txt", "from directory A")
// Assert another run fails with path already exists error from the server
_, _, err := RequireErrorRun(t, "workspace", "import_dir", "./testdata/import_dir/override/b", tmpdir)
assert.Regexp(t, regexp.MustCompile("Path (.*) already exists."), err.Error())

View File

@ -24,7 +24,7 @@ func TestRepoFilesPutFile(t *testing.T) {
ctx := context.Background()
// initialize client
wsfsTmpDir := TemporaryWorkspaceDir(t, w)
wsfsTmpDir := temporaryWorkspaceDir(t, w)
localTmpDir := t.TempDir()
r, err := repofiles.Create(wsfsTmpDir, localTmpDir, w, &repofiles.RepoFileOptions{
OverwriteIfExists: true,
@ -54,7 +54,7 @@ func TestRepoFilesFileOverwritesNotebook(t *testing.T) {
ctx := context.Background()
// initialize client
wsfsTmpDir := TemporaryWorkspaceDir(t, w)
wsfsTmpDir := temporaryWorkspaceDir(t, w)
localTmpDir := t.TempDir()
r, err := repofiles.Create(wsfsTmpDir, localTmpDir, w, &repofiles.RepoFileOptions{
OverwriteIfExists: true,
@ -86,7 +86,7 @@ func TestRepoFilesFileOverwritesEmptyDirectoryTree(t *testing.T) {
ctx := context.Background()
// initialize client
wsfsTmpDir := TemporaryWorkspaceDir(t, w)
wsfsTmpDir := temporaryWorkspaceDir(t, w)
localTmpDir := t.TempDir()
r, err := repofiles.Create(wsfsTmpDir, localTmpDir, w, &repofiles.RepoFileOptions{
OverwriteIfExists: true,
@ -130,7 +130,7 @@ func TestRepoFilesFileInDirOverwritesExistingNotebook(t *testing.T) {
ctx := context.Background()
// initialize client
wsfsTmpDir := TemporaryWorkspaceDir(t, w)
wsfsTmpDir := temporaryWorkspaceDir(t, w)
localTmpDir := t.TempDir()
r, err := repofiles.Create(wsfsTmpDir, localTmpDir, w, &repofiles.RepoFileOptions{
OverwriteIfExists: true,