Skip to content

Commit

Permalink
Fix generator function calls
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Lo-A-Foe <[email protected]>
  • Loading branch information
loafoe committed Feb 10, 2024
1 parent bb6ffb9 commit af013d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
7 changes: 5 additions & 2 deletions internal/services/iam/group/data_source_iam_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"testing"

"github.com/philips-software/terraform-provider-hsdp/internal/tools"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/philips-software/terraform-provider-hsdp/internal/acc"
Expand All @@ -14,6 +16,7 @@ func TestAccDataSourceIAMGroup_basic(t *testing.T) {
org := acc.AccIAMOrgGUID()
name := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
randomPassword, _ := tools.RandomPassword()

resource.Test(t, resource.TestCase{
PreCheck: func() {
Expand All @@ -30,7 +33,7 @@ func TestAccDataSourceIAMGroup_basic(t *testing.T) {
},
{
ResourceName: "data.hsdp_iam_group.test",
Config: testAccDataSourceIAMGroup(org, name, randomName),
Config: testAccDataSourceIAMGroup(org, name, randomName, randomPassword),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.hsdp_iam_group.test", "name", name),
resource.TestCheckResourceAttr("data.hsdp_iam_group.test", "users.#", "1"),
Expand Down Expand Up @@ -69,7 +72,7 @@ data "hsdp_iam_group" "test" {
// USER
randomName,
randomName,
randomPassword,
randomPassword,
org,

// RESOURCE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"testing"

"github.com/philips-software/terraform-provider-hsdp/internal/tools"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/philips-software/terraform-provider-hsdp/internal/acc"
Expand All @@ -15,6 +17,7 @@ func TestAccResourceIAMGroupMembership_basic(t *testing.T) {
resourceName := "hsdp_iam_user.test"
parentOrgID := acc.AccIAMOrgGUID()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
randomPassword, _ := tools.RandomPassword()

resource.Test(t, resource.TestCase{
PreCheck: func() {
Expand All @@ -24,7 +27,7 @@ func TestAccResourceIAMGroupMembership_basic(t *testing.T) {
Steps: []resource.TestStep{
{
ResourceName: resourceName,
Config: testAccResourceIAMUser(parentOrgID, randomName),
Config: testAccResourceIAMUser(parentOrgID, randomName, randomPassword),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "organization_id", parentOrgID),
),
Expand Down
5 changes: 4 additions & 1 deletion internal/services/iam/user/resource_iam_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"testing"

"github.com/philips-software/terraform-provider-hsdp/internal/tools"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/philips-software/terraform-provider-hsdp/internal/acc"
Expand All @@ -15,6 +17,7 @@ func TestAccResourceIAMUser_basic(t *testing.T) {
resourceName := "hsdp_iam_user.test"
parentOrgID := acc.AccIAMOrgGUID()
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
randomPassword, _ := tools.RandomPassword()

resource.Test(t, resource.TestCase{
PreCheck: func() {
Expand All @@ -24,7 +27,7 @@ func TestAccResourceIAMUser_basic(t *testing.T) {
Steps: []resource.TestStep{
{
ResourceName: resourceName,
Config: testAccResourceIAMUser(parentOrgID, randomName),
Config: testAccResourceIAMUser(parentOrgID, randomName, randomPassword),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "organization_id", parentOrgID),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strings"
"testing"

"github.com/philips-software/terraform-provider-hsdp/internal/tools"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/philips-software/terraform-provider-hsdp/internal/acc"
Expand All @@ -17,19 +19,20 @@ func TestAccResourceNotificationProducer_basic(t *testing.T) {
resourceName := "hsdp_notification_producer.principal_producer"
randomName := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
iamOrgID := acc.AccIAMOrgGUID()
randomPassword, _ := tools.RandomPassword()

resource.Test(t, resource.TestCase{
PreCheck: func() { acc.PreCheck(t) },
ProviderFactories: acc.ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccResourceNotificationProducer(randomName, iamOrgID),
Config: testAccResourceNotificationProducer(randomName, iamOrgID, randomPassword),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "description", fmt.Sprintf("acc principal producer %s", randomName)),
),
},
{
Config: testAccResourceNotificationProducer(randomName, iamOrgID) +
Config: testAccResourceNotificationProducer(randomName, iamOrgID, randomPassword) +
fmt.Sprintf(`
resource "hsdp_notification_producer" "producer" {
managing_organization_id = hsdp_iam_org.test.id
Expand Down Expand Up @@ -229,7 +232,7 @@ resource "hsdp_iam_user" "user" {

// IAM USER
random,
password,
password,
random,
)
}

0 comments on commit af013d7

Please sign in to comment.