From 371a79693fa18f8d6835bca15828e6c16041ed0e Mon Sep 17 00:00:00 2001 From: Aleksander Zaruczewski Date: Mon, 23 Oct 2023 02:34:07 -0400 Subject: [PATCH] test(project): fix failing tests (#1404) (cherry picked from commit f64aa9b60ac75f7d9569fdd67fbd4a77aa24ee62) --- internal/service/project/project_user_test.go | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/internal/service/project/project_user_test.go b/internal/service/project/project_user_test.go index d9f7abb1e..51756c081 100644 --- a/internal/service/project/project_user_test.go +++ b/internal/service/project/project_user_test.go @@ -5,11 +5,12 @@ import ( "testing" "github.com/aiven/aiven-go-client" - acc "github.com/aiven/terraform-provider-aiven/internal/acctest" - "github.com/aiven/terraform-provider-aiven/internal/schemautil" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + acc "github.com/aiven/terraform-provider-aiven/internal/acctest" + "github.com/aiven/terraform-provider-aiven/internal/schemautil" ) func TestAccAivenProjectUser_basic(t *testing.T) { @@ -79,14 +80,19 @@ func testAccCheckAivenProjectUserResourceDestroy(s *terraform.State) error { func testAccProjectUserResource(name string) string { return fmt.Sprintf(` +resource "aiven_account" "foo" { + name = "test-acc-ac-%[1]s" +} + resource "aiven_project" "foo" { - project = "test-acc-pr-%s" + project = "test-acc-pr-%[1]s" default_cloud = "aws-eu-west-2" + account_id = aiven_account.foo.id } resource "aiven_project_user" "bar" { project = aiven_project.foo.project - email = "ivan.savciuc+%s@aiven.fi" + email = "ivan.savciuc+%[1]s@aiven.fi" member_type = "admin" } @@ -95,19 +101,24 @@ data "aiven_project_user" "user" { email = aiven_project_user.bar.email depends_on = [aiven_project_user.bar] -}`, name, name) +}`, name) } func testAccProjectUserDeveloperResource(name string) string { return fmt.Sprintf(` +resource "aiven_account" "foo" { + name = "test-acc-ac-%[1]s" +} + resource "aiven_project" "foo" { - project = "test-acc-pr-%s" + project = "test-acc-pr-%[1]s" default_cloud = "aws-eu-west-2" + account_id = aiven_account.foo.id } resource "aiven_project_user" "bar" { project = aiven_project.foo.project - email = "ivan.savciuc+%s@aiven.fi" + email = "ivan.savciuc+%[1]s@aiven.fi" member_type = "developer" } @@ -116,7 +127,7 @@ data "aiven_project_user" "user" { email = aiven_project_user.bar.email depends_on = [aiven_project_user.bar] -}`, name, name) +}`, name) } func testAccCheckAivenProjectUserAttributes(n string) resource.TestCheckFunc {