diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 52d659600..c1ce5db57 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -69,6 +69,8 @@ jobs: env: AIVEN_TOKEN: ${{ secrets.AIVEN_TOKEN }} AIVEN_PROJECT_NAME: ${{ secrets.AIVEN_PROJECT_NAME }} + AIVEN_ORGANIZATION_NAME: ${{ secrets.AIVEN_ORGANIZATION_NAME }} + AIVEN_ACCOUNT_NAME: ${{ secrets.AIVEN_ORGANIZATION_NAME }} PKG: ${{matrix.pkg}} sweep: @@ -106,4 +108,5 @@ jobs: env: AIVEN_TOKEN: ${{ secrets.AIVEN_TOKEN }} AIVEN_PROJECT_NAME: ${{ secrets.AIVEN_PROJECT_NAME }} - + AIVEN_ORGANIZATION_NAME: ${{ secrets.AIVEN_ORGANIZATION_NAME }} + AIVEN_ACCOUNT_NAME: ${{ secrets.AIVEN_ORGANIZATION_NAME }} diff --git a/internal/sdkprovider/service/account/account_authentication_test.go b/internal/sdkprovider/service/account/account_authentication_test.go index 4c3cb85ef..87ce69ba5 100644 --- a/internal/sdkprovider/service/account/account_authentication_test.go +++ b/internal/sdkprovider/service/account/account_authentication_test.go @@ -11,6 +11,7 @@ import ( "fmt" "log" "math/big" + "os" "strings" "testing" "time" @@ -133,6 +134,10 @@ func TestAccAivenAccountAuthentication_saml_invalid_certificate(t *testing.T) { } func TestAccAivenAccountAuthentication_auto_join_team_id(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + resourceName := "aiven_account_authentication.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) @@ -177,19 +182,21 @@ data "aiven_account_authentication" "auth" { } func testAccAccountAuthenticationWithAutoJoinTeamIDResource(name string) string { + orgName := os.Getenv("AIVEN_ACCOUNT_NAME") + return fmt.Sprintf(` -resource "aiven_account" "foo" { - name = "test-acc-ac-%s" +data "aiven_account" "foo" { + name = "%[1]s" } resource "aiven_account_team" "foo" { - account_id = aiven_account.foo.account_id - name = "test-acc-team-%s" + account_id = data.aiven_account.foo.account_id + name = "test-acc-team-%[2]s" } resource "aiven_account_authentication" "foo" { - account_id = aiven_account.foo.account_id - name = "test-acc-auth-%s" + account_id = data.aiven_account.foo.account_id + name = "test-acc-auth-%[2]s" type = "saml" enabled = false auto_join_team_id = aiven_account_team.foo.team_id @@ -207,7 +214,7 @@ data "aiven_account_authentication" "auth" { name = aiven_account_authentication.foo.name depends_on = [aiven_account_authentication.foo] -}`, name, name, name) +}`, orgName, name) } func testAccCheckAivenAccountAuthenticationResourceDestroy(s *terraform.State) error { diff --git a/internal/sdkprovider/service/account/account_team_data_source_test.go b/internal/sdkprovider/service/account/account_team_data_source_test.go index dc05b9cc5..7bff91824 100644 --- a/internal/sdkprovider/service/account/account_team_data_source_test.go +++ b/internal/sdkprovider/service/account/account_team_data_source_test.go @@ -1,6 +1,7 @@ package account_test import ( + "os" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/acctest" @@ -10,6 +11,10 @@ import ( ) func TestAccAivenAccountTeamDataSource_basic(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + datasourceName := "data.aiven_account_team.team" resourceName := "aiven_account_team.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) diff --git a/internal/sdkprovider/service/account/account_team_member_data_source_test.go b/internal/sdkprovider/service/account/account_team_member_data_source_test.go index c893902d5..b87ebe4e7 100644 --- a/internal/sdkprovider/service/account/account_team_member_data_source_test.go +++ b/internal/sdkprovider/service/account/account_team_member_data_source_test.go @@ -1,6 +1,7 @@ package account_test import ( + "os" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/acctest" @@ -10,6 +11,10 @@ import ( ) func TestAccAivenAccountTeamMemberDataSource_basic(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + datasourceName := "data.aiven_account_team_member.member" resourceName := "aiven_account_team_member.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) diff --git a/internal/sdkprovider/service/account/account_team_member_test.go b/internal/sdkprovider/service/account/account_team_member_test.go index c7a270a66..d9c820da7 100644 --- a/internal/sdkprovider/service/account/account_team_member_test.go +++ b/internal/sdkprovider/service/account/account_team_member_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "os" "testing" "github.com/aiven/aiven-go-client/v2" @@ -16,6 +17,10 @@ import ( ) func TestAccAivenAccountTeamMember_basic(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + resourceName := "aiven_account_team_member.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) @@ -37,20 +42,22 @@ func TestAccAivenAccountTeamMember_basic(t *testing.T) { } func testAccAccountTeamMemberResource(name string) string { + orgName := os.Getenv("AIVEN_ACCOUNT_NAME") + return fmt.Sprintf(` -resource "aiven_account" "foo" { - name = "test-acc-ac-%s" +data "aiven_account" "foo" { + name = "%[1]s" } resource "aiven_account_team" "foo" { - account_id = aiven_account.foo.account_id - name = "test-acc-team-%s" + account_id = data.aiven_account.foo.account_id + name = "test-acc-team-%[2]s" } resource "aiven_account_team_member" "foo" { team_id = aiven_account_team.foo.team_id account_id = aiven_account_team.foo.account_id - user_email = "ivan.savciuc+%s@aiven.fi" + user_email = "ivan.savciuc+%[2]s@aiven.fi" } data "aiven_account_team_member" "member" { @@ -59,7 +66,7 @@ data "aiven_account_team_member" "member" { user_email = aiven_account_team_member.foo.user_email depends_on = [aiven_account_team_member.foo] -}`, name, name, name) +}`, orgName, name) } func testAccCheckAivenAccountTeamMemberResourceDestroy(s *terraform.State) error { diff --git a/internal/sdkprovider/service/account/account_team_project_test.go b/internal/sdkprovider/service/account/account_team_project_test.go index 49c3f8fa3..f0ef22f27 100644 --- a/internal/sdkprovider/service/account/account_team_project_test.go +++ b/internal/sdkprovider/service/account/account_team_project_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "os" "testing" "github.com/aiven/aiven-go-client/v2" @@ -16,6 +17,10 @@ import ( ) func TestAccAivenAccountTeamProject_basic(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + resourceName := "aiven_account_team_project.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) @@ -37,23 +42,25 @@ func TestAccAivenAccountTeamProject_basic(t *testing.T) { } func testAccAccountTeamProjectResource(name string) string { + orgName := os.Getenv("AIVEN_ACCOUNT_NAME") + return fmt.Sprintf(` -resource "aiven_account" "foo" { - name = "test-acc-ac-%s" +data "aiven_account" "foo" { + name = "%[1]s" } resource "aiven_account_team" "foo" { - account_id = aiven_account.foo.account_id - name = "test-acc-team-%s" + account_id = data.aiven_account.foo.account_id + name = "test-acc-team-%[2]s" } resource "aiven_project" "foo" { - project = "test-acc-pr-%s" + project = "test-acc-pr-%[2]s" account_id = aiven_account_team.foo.account_id } resource "aiven_account_team_project" "foo" { - account_id = aiven_account.foo.account_id + account_id = data.aiven_account.foo.account_id team_id = aiven_account_team.foo.team_id project_name = aiven_project.foo.project team_type = "admin" @@ -65,7 +72,7 @@ data "aiven_account_team_project" "project" { project_name = aiven_account_team_project.foo.project_name depends_on = [aiven_account_team_project.foo] -}`, name, name, name) +}`, orgName, name) } func testAccCheckAivenAccountTeamProjectResourceDestroy(s *terraform.State) error { diff --git a/internal/sdkprovider/service/account/account_team_test.go b/internal/sdkprovider/service/account/account_team_test.go index 24c9031e0..0e7ae8f54 100644 --- a/internal/sdkprovider/service/account/account_team_test.go +++ b/internal/sdkprovider/service/account/account_team_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "os" "testing" "github.com/aiven/aiven-go-client/v2" @@ -16,6 +17,10 @@ import ( ) func TestAccAivenAccountTeam_basic(t *testing.T) { + if _, ok := os.LookupEnv("AIVEN_ACCOUNT_NAME"); !ok { + t.Skip("AIVEN_ACCOUNT_NAME env variable is required to run this test") + } + resourceName := "aiven_account_team.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) @@ -36,13 +41,15 @@ func TestAccAivenAccountTeam_basic(t *testing.T) { } func testAccAccountTeamResource(name string) string { + orgName := os.Getenv("AIVEN_ACCOUNT_NAME") + return fmt.Sprintf(` -resource "aiven_account" "foo" { - name = "test-acc-ac-%s" +data "aiven_account" "foo" { + name = "%s" } resource "aiven_account_team" "foo" { - account_id = aiven_account.foo.account_id + account_id = data.aiven_account.foo.account_id name = "test-acc-team-%s" } @@ -51,7 +58,7 @@ data "aiven_account_team" "team" { account_id = aiven_account_team.foo.account_id depends_on = [aiven_account_team.foo] -}`, name, name) +}`, orgName, name) } func testAccCheckAivenAccountTeamResourceDestroy(s *terraform.State) error {