Skip to content

Commit

Permalink
Test fixes, delete wait function fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Kita committed Dec 10, 2024
1 parent 097dd9b commit 0770a01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ibm/service/power/resource_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ func isWaitForPIInstanceDeleted(ctx context.Context, client *instance.IBMPIInsta
log.Printf("Waiting for (%s) to be deleted.", id)

stateConf := &retry.StateChangeConf{
Pending: []string{State_Pending, State_Retry, State_Deleting},
Pending: []string{State_Active, State_Deleting, State_Pending, State_Retry, State_Shutoff},
Target: []string{State_NotFound},
Refresh: isPIInstanceRefreshFunc(client, id, Any),
Delay: Timeout_Delay,
Expand Down
14 changes: 7 additions & 7 deletions ibm/service/power/resource_ibm_pi_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func TestAccIBMPIInstanceBasic(t *testing.T) {
CheckDestroy: testAccCheckIBMPIInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckIBMPIInstanceConfig(name, power.Warning),
Config: testAccCheckIBMPIInstanceConfig(name, power.OK),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMPIInstanceExists(instanceRes),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name),
Expand Down Expand Up @@ -683,6 +683,7 @@ func testAccIBMPIInstanceMixedStorage(name, healthStatus string) string {
func TestAccIBMPIInstanceUpdateActiveState(t *testing.T) {
instanceRes := "ibm_pi_instance.power_instance"
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))
nameUpdated := name + "-updated"
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
Expand All @@ -697,13 +698,12 @@ func TestAccIBMPIInstanceUpdateActiveState(t *testing.T) {
),
},
{
Config: testAccCheckIBMPIActiveInstanceConfigUpdate(name, power.OK, "0.5", "4"),
Config: testAccCheckIBMPIActiveInstanceConfigUpdate(nameUpdated, power.OK, "0.5", "4"),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMPIInstanceStatus(instanceRes, strings.ToUpper(power.State_Active)),
testAccCheckIBMPIInstanceExists(instanceRes),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", nameUpdated),
),
ExpectNonEmptyPlan: true,
},
},
})
Expand All @@ -712,6 +712,7 @@ func TestAccIBMPIInstanceUpdateActiveState(t *testing.T) {
func TestAccIBMPIInstanceUpdateStoppedState(t *testing.T) {
instanceRes := "ibm_pi_instance.power_instance"
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))
nameUpdated := name + "-updated"
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
Expand All @@ -725,13 +726,12 @@ func TestAccIBMPIInstanceUpdateStoppedState(t *testing.T) {
),
},
{
Config: testAccCheckIBMPIStoppedInstanceConfigUpdate(name, power.OK, "0.5", "4", "stop"),
Config: testAccCheckIBMPIStoppedInstanceConfigUpdate(nameUpdated, power.OK, "0.5", "4", "stop"),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMPIInstanceStatus(instanceRes, strings.ToUpper(power.State_Shutoff)),
testAccCheckIBMPIInstanceExists(instanceRes),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", nameUpdated),
),
ExpectNonEmptyPlan: true,
},
},
})
Expand Down

0 comments on commit 0770a01

Please sign in to comment.