From efc72b5bbd697ec739b9b6c460e2f7a2ef1fb873 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 2 Jun 2023 00:15:02 +0200 Subject: [PATCH] - --- internal/filer_test.go | 2 +- internal/helpers.go | 2 +- internal/import_dir_test.go | 5 ++--- internal/repofiles_test.go | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/filer_test.go b/internal/filer_test.go index 80935220..223f5d84 100644 --- a/internal/filer_test.go +++ b/internal/filer_test.go @@ -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) diff --git a/internal/helpers.go b/internal/helpers.go index 0f739429..f1901f14 100644 --- a/internal/helpers.go +++ b/internal/helpers.go @@ -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) diff --git a/internal/import_dir_test.go b/internal/import_dir_test.go index 27a53d5f..6120607f 100644 --- a/internal/import_dir_test.go +++ b/internal/import_dir_test.go @@ -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()) diff --git a/internal/repofiles_test.go b/internal/repofiles_test.go index 055fe0c2..07c488e0 100644 --- a/internal/repofiles_test.go +++ b/internal/repofiles_test.go @@ -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,