diff --git a/internal/provider/data_source_folder_test.go b/internal/provider/data_source_folder_test.go index 2c0071d..162e591 100644 --- a/internal/provider/data_source_folder_test.go +++ b/internal/provider/data_source_folder_test.go @@ -9,8 +9,6 @@ import ( func TestAccDataSourceFolderAttributes(t *testing.T) { ensureVaultwardenConfigured(t) - resourceName := "bitwarden_folder.foo" - resource.UnitTest(t, resource.TestCase{ ProviderFactories: providerFactories, Steps: []resource.TestStep{ @@ -19,7 +17,7 @@ func TestAccDataSourceFolderAttributes(t *testing.T) { }, { Config: tfConfigProvider() + tfConfigResourceFolder() + tfConfigDataFolder(), - Check: checkObject(resourceName), + Check: checkObject("data.bitwarden_folder.foo_data"), }, }, }) diff --git a/internal/provider/data_source_item_login_test.go b/internal/provider/data_source_item_login_test.go index 064244d..4c0cede 100644 --- a/internal/provider/data_source_item_login_test.go +++ b/internal/provider/data_source_item_login_test.go @@ -62,6 +62,9 @@ func TestAccDataSourceItemLoginBySearch(t *testing.T) { resource.UnitTest(t, resource.TestCase{ ProviderFactories: providerFactories, Steps: []resource.TestStep{ + { + Config: tfConfigProvider() + tfConfigResourceItemLogin(), + }, { Config: tfConfigProvider() + tfConfigResourceItemLogin() + tfConfigDataItemLoginWithSearchAndOrg("test-username"), Check: checkItemLogin("data.bitwarden_item_login.foo_data"), diff --git a/internal/provider/provider_utils_test.go b/internal/provider/provider_utils_test.go index 5ae9c42..e0ecac8 100644 --- a/internal/provider/provider_utils_test.go +++ b/internal/provider/provider_utils_test.go @@ -128,6 +128,7 @@ func createTestOrganization(t *testing.T) { func createTestUserResources(t *testing.T) { testFolderName := fmt.Sprintf("folder-%s-bar", testUniqueIdentifier) bwClient := bwTestClient(t) + t.Logf("Creating Folder") folder, err := bwClient.CreateObject(context.Background(), bw.Object{ Object: bw.ObjectTypeFolder, Name: testFolderName, @@ -173,9 +174,19 @@ func bwTestClient(t *testing.T) bw.Client { } } if status.Status == bw.StatusUnauthenticated { - err = client.LoginWithPassword(context.Background(), testEmail, testPassword) - if err != nil { - t.Fatal(err) + + retries := 0 + for retries < 3 { + err = client.LoginWithPassword(context.Background(), testEmail, testPassword) + if err != nil { + // Retry if the user creation hasn't been fully taken into account yet + if retries < 3 { + retries++ + time.Sleep(1 * time.Second) + continue + } + t.Fatal(err) + } } } else if status.Status == bw.StatusLocked { err = client.Unlock(context.Background(), testPassword)