Skip to content

Commit

Permalink
Do not put machine in failed state if VM is is topping or stopped sta…
Browse files Browse the repository at this point in the history
…te, and use ID from instance during deletion
  • Loading branch information
shyamradhakrishnan committed Oct 19, 2023
1 parent 0b7d78d commit 4f32a55
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cloud/scope/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,7 @@ func TestInstanceDeletion(t *testing.T) {
expectedEvent string
eventNotExpected string
matchError error
instance *core.Instance
errorSubStringMatch bool
testSpecificSetup func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient)
}{
Expand All @@ -2406,6 +2407,9 @@ func TestInstanceDeletion(t *testing.T) {
PreserveBootVolume: common.Bool(false),
})).Return(core.TerminateInstanceResponse{}, nil)
},
instance: &core.Instance{
Id: common.String("test"),
},
},
{
name: "delete instance error",
Expand All @@ -2418,6 +2422,9 @@ func TestInstanceDeletion(t *testing.T) {
PreserveBootVolume: common.Bool(false),
})).Return(core.TerminateInstanceResponse{}, errors.New("could not terminate instance"))
},
instance: &core.Instance{
Id: common.String("test"),
},
},
}

Expand All @@ -2427,7 +2434,7 @@ func TestInstanceDeletion(t *testing.T) {
defer teardown(t, g)
setup(t, g)
tc.testSpecificSetup(ms, computeClient)
err := ms.DeleteMachine(context.Background())
err := ms.DeleteMachine(context.Background(), tc.instance)
if tc.errorExpected {
g.Expect(err).To(Not(BeNil()))
if tc.errorSubStringMatch {
Expand Down

0 comments on commit 4f32a55

Please sign in to comment.