Skip to content

Commit

Permalink
test(opensearch): fix weak password error (#1395)
Browse files Browse the repository at this point in the history
(cherry picked from commit c464bfd)
  • Loading branch information
Serpentiel committed Oct 26, 2023
1 parent 4d3801a commit a40cb3d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/service/opensearch/opensearch_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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),
),
},
},
Expand Down Expand Up @@ -69,28 +72,28 @@ 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"
}
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)
}

0 comments on commit a40cb3d

Please sign in to comment.