Skip to content

Commit 4f32a55

Browse files
Do not put machine in failed state if VM is is topping or stopped state, and use ID from instance during deletion
1 parent 0b7d78d commit 4f32a55

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cloud/scope/machine_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2393,6 +2393,7 @@ func TestInstanceDeletion(t *testing.T) {
23932393
expectedEvent string
23942394
eventNotExpected string
23952395
matchError error
2396+
instance *core.Instance
23962397
errorSubStringMatch bool
23972398
testSpecificSetup func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient)
23982399
}{
@@ -2406,6 +2407,9 @@ func TestInstanceDeletion(t *testing.T) {
24062407
PreserveBootVolume: common.Bool(false),
24072408
})).Return(core.TerminateInstanceResponse{}, nil)
24082409
},
2410+
instance: &core.Instance{
2411+
Id: common.String("test"),
2412+
},
24092413
},
24102414
{
24112415
name: "delete instance error",
@@ -2418,6 +2422,9 @@ func TestInstanceDeletion(t *testing.T) {
24182422
PreserveBootVolume: common.Bool(false),
24192423
})).Return(core.TerminateInstanceResponse{}, errors.New("could not terminate instance"))
24202424
},
2425+
instance: &core.Instance{
2426+
Id: common.String("test"),
2427+
},
24212428
},
24222429
}
24232430

@@ -2427,7 +2434,7 @@ func TestInstanceDeletion(t *testing.T) {
24272434
defer teardown(t, g)
24282435
setup(t, g)
24292436
tc.testSpecificSetup(ms, computeClient)
2430-
err := ms.DeleteMachine(context.Background())
2437+
err := ms.DeleteMachine(context.Background(), tc.instance)
24312438
if tc.errorExpected {
24322439
g.Expect(err).To(Not(BeNil()))
24332440
if tc.errorSubStringMatch {

0 commit comments

Comments
 (0)