From fc3ae6371e194269ed59404abc04cfb6654800b2 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 6 Dec 2024 01:08:57 +0530 Subject: [PATCH] test in parallel with waitgroup --- internal/filer_test.go | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/internal/filer_test.go b/internal/filer_test.go index 8a1e592e..d151f9ac 100644 --- a/internal/filer_test.go +++ b/internal/filer_test.go @@ -10,6 +10,7 @@ import ( "path" "regexp" "strings" + "sync" "testing" "github.com/databricks/cli/libs/filer" @@ -364,9 +365,17 @@ func TestFilerReadDir(t *testing.T) { func TestAccFilerWorkspaceNotebook(t *testing.T) { t.Parallel() + wg := sync.WaitGroup{} + for i := 0; i < 10; i++ { - testAccFilerWorkspacenotebook(t) + wg.Add(1) + go func() { + testAccFilerWorkspacenotebook(t) + wg.Done() + }() } + + wg.Wait() } func testAccFilerWorkspacenotebook(t *testing.T) { @@ -668,9 +677,17 @@ func testAccFilerWorkspaceFilesExtensionsDelete(t *testing.T) { func TestAccFilerWorkspaceFilesExtensionsDelete(t *testing.T) { t.Parallel() + wg := sync.WaitGroup{} + for i := 0; i < 10; i++ { - testAccFilerWorkspaceFilesExtensionsDelete(t) + wg.Add(1) + go func() { + testAccFilerWorkspaceFilesExtensionsDelete(t) + wg.Done() + }() } + + wg.Wait() } func TestFilerWorkspaceFilesExtensionsStat(t *testing.T) { @@ -793,9 +810,17 @@ func testAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T) func TestAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t *testing.T) { t.Parallel() + wg := sync.WaitGroup{} + for i := 0; i < 10; i++ { - testAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t) + wg.Add(1) + go func() { + testAccWorkspaceFilesExtensionsNotebooksAreNotDeletedAsFiles(t) + wg.Done() + }() } + + wg.Wait() } func TestWorkspaceFilesExtensions_ExportFormatIsPreserved(t *testing.T) {