Compare commits

..

2 Commits

Author SHA1 Message Date
Shreyas Goenka fc3ae6371e
test in parallel with waitgroup 2024-12-06 01:08:57 +05:30
Shreyas Goenka d7f31f9eae
- 2024-12-06 00:33:25 +05:30
1 changed files with 51 additions and 8 deletions

View File

@ -10,6 +10,7 @@ import (
"path" "path"
"regexp" "regexp"
"strings" "strings"
"sync"
"testing" "testing"
"github.com/databricks/cli/libs/filer" "github.com/databricks/cli/libs/filer"
@ -361,9 +362,23 @@ func TestFilerReadDir(t *testing.T) {
} }
} }
func TestFilerWorkspaceNotebook(t *testing.T) { func TestAccFilerWorkspaceNotebook(t *testing.T) {
t.Parallel() t.Parallel()
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
testAccFilerWorkspacenotebook(t)
wg.Done()
}()
}
wg.Wait()
}
func testAccFilerWorkspacenotebook(t *testing.T) {
ctx := context.Background() ctx := context.Background()
var err error var err error
@ -468,7 +483,6 @@ func TestFilerWorkspaceNotebook(t *testing.T) {
filerTest{t, f}.assertContents(ctx, tc.nameWithoutExt, tc.expected2) filerTest{t, f}.assertContents(ctx, tc.nameWithoutExt, tc.expected2)
}) })
} }
} }
func TestFilerWorkspaceFilesExtensionsReadDir(t *testing.T) { func TestFilerWorkspaceFilesExtensionsReadDir(t *testing.T) {
@ -612,9 +626,7 @@ func TestFilerWorkspaceFilesExtensionsRead(t *testing.T) {
assert.ErrorIs(t, err, fs.ErrNotExist) assert.ErrorIs(t, err, fs.ErrNotExist)
} }
func TestFilerWorkspaceFilesExtensionsDelete(t *testing.T) { func testAccFilerWorkspaceFilesExtensionsDelete(t *testing.T) {
t.Parallel()
ctx := context.Background() ctx := context.Background()
wf := setupFilerWithExtensionsTest(t) wf := setupFilerWithExtensionsTest(t)
@ -659,6 +671,23 @@ func TestFilerWorkspaceFilesExtensionsDelete(t *testing.T) {
err = wf.Delete(ctx, "dir", filer.DeleteRecursively) err = wf.Delete(ctx, "dir", filer.DeleteRecursively)
require.NoError(t, err) require.NoError(t, err)
filerTest{t, wf}.assertNotExists(ctx, "dir") filerTest{t, wf}.assertNotExists(ctx, "dir")
}
func TestAccFilerWorkspaceFilesExtensionsDelete(t *testing.T) {
t.Parallel()
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
testAccFilerWorkspaceFilesExtensionsDelete(t)
wg.Done()
}()
}
wg.Wait()
} }
func TestFilerWorkspaceFilesExtensionsStat(t *testing.T) { func TestFilerWorkspaceFilesExtensionsStat(t *testing.T) {
@ -761,9 +790,7 @@ func TestWorkspaceFilesExtensionsNotebooksAreNotStatAsFiles(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
} }
func TestAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T) { func testAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T) {
t.Parallel()
ctx := context.Background() ctx := context.Background()
wf, _ := setupWsfsExtensionsFiler(t) wf, _ := setupWsfsExtensionsFiler(t)
@ -780,6 +807,22 @@ func TestAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T)
assert.NoError(t, err) assert.NoError(t, err)
} }
func TestAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T) {
t.Parallel()
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
testAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t)
wg.Done()
}()
}
wg.Wait()
}
func TestWorkspaceFilesExtensions_ExportFormatIsPreserved(t *testing.T) { func TestWorkspaceFilesExtensions_ExportFormatIsPreserved(t *testing.T) {
t.Parallel() t.Parallel()