Skip to content

Commit

Permalink
[Internal] Scope the traversing directory in the Recursive list works…
Browse files Browse the repository at this point in the history
…pace test (#1120)

## What changes are proposed in this pull request?
What - The PR modifies the scope of directory traversal in the recursive
list test. It limits the search to the ".sdk" directory, where the
relevant notebook is created.

Why - The test was previously hitting API rate limits because it was
scanning too many elements in the current traversing directory. By
narrowing the scope to the ".sdk" directory, the test can now run more
efficiently without encountering these limits.

## How is this tested?
This is itself an integration test.
  • Loading branch information
parthban-db authored Jan 13, 2025
1 parent b83a726 commit 914ab6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

func myNotebookPath(t *testing.T, w *databricks.WorkspaceClient) string {
ctx := context.Background()
testDir := filepath.Join("/Users", me(t, w).UserName, ".sdk", RandomName("t-"))
testDir := filepath.Join("/Users", me(t, w).UserName, ".sdk", "notebooks", RandomName("t-"))
notebook := filepath.Join(testDir, RandomName("n-"))

err := w.Workspace.MkdirsByPath(ctx, testDir)
Expand Down Expand Up @@ -224,7 +224,7 @@ func TestAccWorkspaceRecursiveListNoTranspile(t *testing.T) {
workspace.UploadOverwrite())
require.NoError(t, err)

allMyNotebooks, err := w.Workspace.RecursiveList(ctx, filepath.Join("/Users", me(t, w).UserName))
allMyNotebooks, err := w.Workspace.RecursiveList(ctx, filepath.Join("/Users", me(t, w).UserName, ".sdk"))
require.NoError(t, err)
assert.True(t, len(allMyNotebooks) >= 1)
}

0 comments on commit 914ab6b

Please sign in to comment.