diff --git a/internal/service/opensearch/opensearch_user_test.go b/internal/service/opensearch/opensearch_user_test.go index a1715bc36..64e31721b 100644 --- a/internal/service/opensearch/opensearch_user_test.go +++ b/internal/service/opensearch/opensearch_user_test.go @@ -14,6 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) +// opensearchTestPassword is the password used for the OpenSearch tests. +const opensearchTestPassword = "ThisIsATest123^=^" + func TestAccAivenOpensearchUser_basic(t *testing.T) { resourceName := "aiven_opensearch_user.foo" rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) @@ -30,7 +33,7 @@ func TestAccAivenOpensearchUser_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "service_name", fmt.Sprintf("test-acc-sr-%s", rName)), resource.TestCheckResourceAttr(resourceName, "project", os.Getenv("AIVEN_PROJECT_NAME")), resource.TestCheckResourceAttr(resourceName, "username", fmt.Sprintf("user-%s", rName)), - resource.TestCheckResourceAttr(resourceName, "password", "Test$1234"), + resource.TestCheckResourceAttr(resourceName, "password", opensearchTestPassword), ), }, }, @@ -69,14 +72,14 @@ func testAccCheckAivenOpensearchUserResourceDestroy(s *terraform.State) error { func testAccOpensearchUserResource(name string) string { return fmt.Sprintf(` data "aiven_project" "foo" { - project = "%s" + project = "%[1]s" } resource "aiven_opensearch" "bar" { project = data.aiven_project.foo.project cloud_name = "google-europe-west1" plan = "startup-4" - service_name = "test-acc-sr-%s" + service_name = "test-acc-sr-%[2]s" maintenance_window_dow = "monday" maintenance_window_time = "10:00:00" } @@ -84,13 +87,13 @@ resource "aiven_opensearch" "bar" { resource "aiven_opensearch_user" "foo" { service_name = aiven_opensearch.bar.service_name project = data.aiven_project.foo.project - username = "user-%s" - password = "Test$1234" + username = "user-%[2]s" + password = "%[3]s" } data "aiven_opensearch_user" "user" { service_name = aiven_opensearch_user.foo.service_name project = aiven_opensearch_user.foo.project username = aiven_opensearch_user.foo.username -}`, os.Getenv("AIVEN_PROJECT_NAME"), name, name) +}`, os.Getenv("AIVEN_PROJECT_NAME"), name, opensearchTestPassword) }