diff --git a/core/plans/const.go b/core/plans/const.go index 50f6e8917..32aad7fba 100644 --- a/core/plans/const.go +++ b/core/plans/const.go @@ -3,4 +3,6 @@ package plans const ( MicroVMDeletePlanName = "microvm_delete" MicroVMCreateOrUpdatePlanName = "microvm_create_update" + + microVMBootTime = 30 ) diff --git a/core/plans/microvm_create_update.go b/core/plans/microvm_create_update.go index 238c5d771..0da1ae84b 100644 --- a/core/plans/microvm_create_update.go +++ b/core/plans/microvm_create_update.go @@ -75,7 +75,7 @@ func (p *microvmCreateOrUpdatePlan) Create(ctx context.Context) ([]planner.Proce } // MicroVM provider start - if err := p.addStep(ctx, microvm.NewStartStep(p.vm, ports.Provider)); err != nil { + if err := p.addStep(ctx, microvm.NewStartStep(p.vm, ports.Provider, microVMBootTime)); err != nil { return nil, fmt.Errorf("adding microvm start step: %w", err) } diff --git a/core/steps/event/publish_test.go b/core/steps/event/publish_test.go index 0b0e93bb8..a751823a1 100644 --- a/core/steps/event/publish_test.go +++ b/core/steps/event/publish_test.go @@ -41,10 +41,12 @@ func TestNewPublish(t *testing.T) { // now than crying later if the system does not do what we want. shouldDo, _ := step.ShouldDo(ctx) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeTrue()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).To(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewPublish_eventServiceFailure(t *testing.T) { @@ -67,7 +69,9 @@ func TestNewPublish_eventServiceFailure(t *testing.T) { step := event.NewPublish(testTopic, evt, eventService) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } diff --git a/core/steps/microvm/create_test.go b/core/steps/microvm/create_test.go index 901af2d9e..af094046e 100644 --- a/core/steps/microvm/create_test.go +++ b/core/steps/microvm/create_test.go @@ -58,11 +58,13 @@ func TestNewCreateStep(t *testing.T) { shouldDo, shouldErr := step.ShouldDo(ctx) subSteps, doErr := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeTrue()) g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewCreateStep_StateCheck(t *testing.T) { @@ -96,9 +98,11 @@ func TestNewCreateStep_StateCheck(t *testing.T) { Return(testCase.State, nil) shouldDo, shouldErr := step.ShouldDo(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.Equal(testCase.ExpectToRun)) g.Expect(shouldErr).To(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } } @@ -119,9 +123,11 @@ func TestNewCreateStep_StateCheckError(t *testing.T) { Return(ports.MicroVMStateUnknown, errors.New("i have no idea")) shouldDo, shouldErr := step.ShouldDo(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewCreateStep_VMIsNotDefined(t *testing.T) { @@ -137,9 +143,11 @@ func TestNewCreateStep_VMIsNotDefined(t *testing.T) { step := microvm.NewCreateStep(vm, microVMService) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).To(g.MatchError(internalerr.ErrSpecRequired)) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewCreateStep_ServiceCreateError(t *testing.T) { @@ -159,7 +167,9 @@ func TestNewCreateStep_ServiceCreateError(t *testing.T) { Return(errors.New("ensuring state dir: ....")) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } diff --git a/core/steps/microvm/delete_test.go b/core/steps/microvm/delete_test.go index b5f1a3954..90028db54 100644 --- a/core/steps/microvm/delete_test.go +++ b/core/steps/microvm/delete_test.go @@ -59,11 +59,13 @@ func TestNewDeleteStep(t *testing.T) { shouldDo, shouldErr := step.ShouldDo(ctx) subSteps, doErr := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeTrue()) g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewDeleteStep_StateCheck(t *testing.T) { @@ -97,9 +99,11 @@ func TestNewDeleteStep_StateCheck(t *testing.T) { Return(testCase.State, nil) shouldDo, shouldErr := step.ShouldDo(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.Equal(testCase.ExpectToRun)) g.Expect(shouldErr).To(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } } @@ -120,9 +124,11 @@ func TestNewDeleteStep_StateCheckError(t *testing.T) { Return(ports.MicroVMStateUnknown, errors.New("i have no idea")) shouldDo, shouldErr := step.ShouldDo(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewDeleteStep_VMIsNotDefined(t *testing.T) { @@ -138,9 +144,11 @@ func TestNewDeleteStep_VMIsNotDefined(t *testing.T) { step := microvm.NewDeleteStep(vm, microVMService) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).To(g.MatchError(internalerr.ErrSpecRequired)) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewDeleteStep_ServiceDeleteError(t *testing.T) { @@ -160,7 +168,9 @@ func TestNewDeleteStep_ServiceDeleteError(t *testing.T) { Return(errors.New("ensuring state dir: ....")) subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.BeNil()) } diff --git a/core/steps/microvm/start.go b/core/steps/microvm/start.go index 013dcf405..839681bc9 100644 --- a/core/steps/microvm/start.go +++ b/core/steps/microvm/start.go @@ -14,18 +14,22 @@ import ( "github.com/weaveworks/flintlock/pkg/planner" ) -const waitToBoot = 5 - -func NewStartStep(vm *models.MicroVM, vmSvc ports.MicroVMService) planner.Procedure { +func NewStartStep( + vm *models.MicroVM, + vmSvc ports.MicroVMService, + bootTime int, +) planner.Procedure { return &startStep{ - vm: vm, - vmSvc: vmSvc, + vm: vm, + vmSvc: vmSvc, + bootTime: bootTime, } } type startStep struct { - vm *models.MicroVM - vmSvc ports.MicroVMService + vm *models.MicroVM + vmSvc ports.MicroVMService + bootTime int } // Name is the name of the procedure/operation. @@ -73,7 +77,7 @@ func (s *startStep) Verify(ctx context.Context) error { "vmid": s.vm.ID, }) logger.Debug("waiting for the microvm to start") - time.Sleep(waitToBoot * time.Second) + time.Sleep(time.Duration(s.bootTime) * time.Second) logger.Debug("verify microvm is started") state, err := s.vmSvc.State(ctx, s.vm.ID.String()) diff --git a/core/steps/microvm/start_test.go b/core/steps/microvm/start_test.go index 42d90c5ea..40edae24b 100644 --- a/core/steps/microvm/start_test.go +++ b/core/steps/microvm/start_test.go @@ -44,13 +44,18 @@ func TestNewStartStep(t *testing.T) { ctx := context.Background() vm := testVMToStart() - step := microvm.NewStartStep(vm, microVMService) + step := microvm.NewStartStep(vm, microVMService, 1) microVMService. EXPECT(). State(ctx, vm.ID.String()). Return(ports.MicroVMStateConfigured, nil) + microVMService. + EXPECT(). + State(ctx, vm.ID.String()). + Return(ports.MicroVMStateRunning, nil) + microVMService. EXPECT(). Start(ctx, vm.ID.String()). @@ -58,11 +63,13 @@ func TestNewStartStep(t *testing.T) { shouldDo, shouldErr := step.ShouldDo(ctx) subSteps, doErr := step.Do(ctx) + verifyErr := step.Verify(ctx) g.Expect(shouldDo).To(g.BeTrue()) g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + g.Expect(verifyErr).To(g.BeNil()) } func TestNewStartStep_StateCheck(t *testing.T) { @@ -87,7 +94,7 @@ func TestNewStartStep_StateCheck(t *testing.T) { ctx := context.Background() vm := testVMToStart() - step := microvm.NewStartStep(vm, microVMService) + step := microvm.NewStartStep(vm, microVMService, 1) for _, testCase := range stateTestCases { microVMService. @@ -100,7 +107,6 @@ func TestNewStartStep_StateCheck(t *testing.T) { g.Expect(shouldDo).To(g.Equal(testCase.ExpectToRun)) g.Expect(shouldErr).To(g.BeNil()) } - } func TestNewStartStep_StateCheckError(t *testing.T) { @@ -112,7 +118,7 @@ func TestNewStartStep_StateCheckError(t *testing.T) { ctx := context.Background() vm := testVMToStart() - step := microvm.NewStartStep(vm, microVMService) + step := microvm.NewStartStep(vm, microVMService, 1) microVMService. EXPECT(). @@ -135,7 +141,7 @@ func TestNewStartStep_VMIsNotDefined(t *testing.T) { microVMService := mock.NewMockMicroVMService(mockCtrl) ctx := context.Background() - step := microvm.NewStartStep(vm, microVMService) + step := microvm.NewStartStep(vm, microVMService, 1) subSteps, err := step.Do(ctx) @@ -152,7 +158,7 @@ func TestNewStartStep_ServiceStartError(t *testing.T) { vm := testVMToStart() ctx := context.Background() - step := microvm.NewStartStep(vm, microVMService) + step := microvm.NewStartStep(vm, microVMService, 1) microVMService. EXPECT(). @@ -164,3 +170,42 @@ func TestNewStartStep_ServiceStartError(t *testing.T) { g.Expect(subSteps).To(g.BeEmpty()) g.Expect(err).ToNot(g.BeNil()) } + +func TestNewStartStep_unableToBoot(t *testing.T) { + g.RegisterTestingT(t) + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + microVMService := mock.NewMockMicroVMService(mockCtrl) + vm := testVMToStart() + ctx := context.Background() + + step := microvm.NewStartStep(vm, microVMService, 1) + + microVMService. + EXPECT(). + Start(ctx, vm.ID.String()). + Return(nil) + + microVMService. + EXPECT(). + State(ctx, vm.ID.String()). + Return(ports.MicroVMStateUnknown, nil) + + subSteps, err := step.Do(ctx) + verifyErr := step.Verify(ctx) + + g.Expect(subSteps).To(g.BeEmpty()) + g.Expect(err).To(g.BeNil()) + g.Expect(verifyErr).To(g.MatchError(internalerr.ErrUnableToBoot)) + + microVMService. + EXPECT(). + State(ctx, vm.ID.String()). + Return(ports.MicroVMStateUnknown, errors.New("nope")) + + verifyErr = step.Verify(ctx) + + g.Expect(verifyErr).ToNot(g.BeNil()) + g.Expect(verifyErr).ToNot(g.MatchError(internalerr.ErrUnableToBoot)) +} diff --git a/core/steps/network/interface_create_test.go b/core/steps/network/interface_create_test.go index 3d3c41284..44e15a0cc 100644 --- a/core/steps/network/interface_create_test.go +++ b/core/steps/network/interface_create_test.go @@ -30,14 +30,16 @@ func TestNewNetworkInterface_everythingIsEmpty(t *testing.T) { Times(0) step := network.NewNetworkInterface(vmid, iface, status, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeTrue()) _, err = step.Do(ctx) - g.Expect(err).To(g.MatchError(errors.ErrGuestDeviceNameRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_doesNotExist(t *testing.T) { @@ -81,8 +83,10 @@ func TestNewNetworkInterface_doesNotExist(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_emptyStatus(t *testing.T) { @@ -116,8 +120,10 @@ func TestNewNetworkInterface_emptyStatus(t *testing.T) { Times(0) _, err = step.Do(ctx) - g.Expect(err).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_existingInterface(t *testing.T) { @@ -168,8 +174,10 @@ func TestNewNetworkInterface_existingInterface(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_missingInterface(t *testing.T) { @@ -241,8 +249,10 @@ func TestNewNetworkInterface_svcError(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) _, err = step.Do(ctx) - g.Expect(err).To(g.MatchError(errors.ErrParentIfaceRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_fillChangedStatus(t *testing.T) { @@ -275,10 +285,12 @@ func TestNewNetworkInterface_fillChangedStatus(t *testing.T) { Times(1) _, err := step.Do(ctx) - g.Expect(err).To(g.BeNil()) g.Expect(status.MACAddress).To(g.Equal(reverseMACAddress)) g.Expect(status.HostDeviceName).To(g.Equal(expectedTapDeviceName)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestNewNetworkInterface_createError(t *testing.T) { @@ -298,8 +310,8 @@ func TestNewNetworkInterface_createError(t *testing.T) { Times(0) step := network.NewNetworkInterface(vmid, iface, status, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeTrue()) @@ -314,6 +326,8 @@ func TestNewNetworkInterface_createError(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).To(g.MatchError(errors.ErrParentIfaceRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } diff --git a/core/steps/network/interface_delete_test.go b/core/steps/network/interface_delete_test.go index bf2c690a3..c49a10432 100644 --- a/core/steps/network/interface_delete_test.go +++ b/core/steps/network/interface_delete_test.go @@ -31,8 +31,8 @@ func TestDeleteNetworkInterface_doesNotExist(t *testing.T) { Times(1) step := network.DeleteNetworkInterface(vmid, iface, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeFalse()) @@ -42,8 +42,10 @@ func TestDeleteNetworkInterface_doesNotExist(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestDeleteNetworkInterface_emptyStatus(t *testing.T) { @@ -58,14 +60,16 @@ func TestDeleteNetworkInterface_emptyStatus(t *testing.T) { ctx := context.Background() step := network.DeleteNetworkInterface(vmid, iface, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeFalse()) _, err = step.Do(ctx) - g.Expect(err).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestDeleteNetworkInterface_exists(t *testing.T) { @@ -85,8 +89,8 @@ func TestDeleteNetworkInterface_exists(t *testing.T) { Times(1) step := network.DeleteNetworkInterface(vmid, iface, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeTrue()) @@ -104,8 +108,10 @@ func TestDeleteNetworkInterface_exists(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestDeleteNetworkInterface_exists_errorDeleting(t *testing.T) { @@ -125,8 +131,8 @@ func TestDeleteNetworkInterface_exists_errorDeleting(t *testing.T) { Times(1) step := network.DeleteNetworkInterface(vmid, iface, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).To(g.BeNil()) g.Expect(shouldDo).To(g.BeTrue()) @@ -144,8 +150,10 @@ func TestDeleteNetworkInterface_exists_errorDeleting(t *testing.T) { Times(1) _, err = step.Do(ctx) - g.Expect(err).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } func TestDeleteNetworkInterface_IfaceExistsError(t *testing.T) { @@ -165,12 +173,14 @@ func TestDeleteNetworkInterface_IfaceExistsError(t *testing.T) { Times(2) step := network.DeleteNetworkInterface(vmid, iface, svc) - shouldDo, err := step.ShouldDo(ctx) + shouldDo, err := step.ShouldDo(ctx) g.Expect(err).ToNot(g.BeNil()) g.Expect(shouldDo).To(g.BeFalse()) _, err = step.Do(ctx) - g.Expect(err).To(g.MatchError(errors.ErrParentIfaceRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).ToNot(g.BeNil()) } diff --git a/core/steps/runtime/dir_create_test.go b/core/steps/runtime/dir_create_test.go index c1979afe8..5402b3594 100644 --- a/core/steps/runtime/dir_create_test.go +++ b/core/steps/runtime/dir_create_test.go @@ -6,6 +6,7 @@ import ( "testing" . "github.com/onsi/gomega" + g "github.com/onsi/gomega" "github.com/spf13/afero" "github.com/weaveworks/flintlock/core/steps/runtime" @@ -27,6 +28,9 @@ func TestCreateDirectory_NotExists(t *testing.T) { Expect(err).NotTo(HaveOccurred()) Expect(len(childSteps)).To(Equal(0)) + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) + testDirExists(t, testDir, dirMode, fs) } @@ -52,6 +56,9 @@ func TestCreateDirectory_Exists(t *testing.T) { Expect(err).NotTo(HaveOccurred()) Expect(len(childSteps)).To(Equal(0)) + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) + testDirExists(t, testDir, dirMode, fs) } @@ -78,6 +85,9 @@ func TestCreateDirectory_ExistsButChangeMode(t *testing.T) { Expect(err).NotTo(HaveOccurred()) Expect(len(childSteps)).To(Equal(0)) + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) + testDirExists(t, testDir, dirMode, fs) } diff --git a/core/steps/runtime/dir_delete_test.go b/core/steps/runtime/dir_delete_test.go index e4f50288a..656b240c7 100644 --- a/core/steps/runtime/dir_delete_test.go +++ b/core/steps/runtime/dir_delete_test.go @@ -5,14 +5,13 @@ import ( "os" "testing" - "github.com/onsi/gomega" + g "github.com/onsi/gomega" "github.com/spf13/afero" - "github.com/stretchr/testify/assert" "github.com/weaveworks/flintlock/core/steps/runtime" ) func TestDeleteDirectory_NotExists(t *testing.T) { - gomega.RegisterTestingT(t) + g.RegisterTestingT(t) testDir := "/test/or/not-to-test" @@ -22,15 +21,17 @@ func TestDeleteDirectory_NotExists(t *testing.T) { step := runtime.NewDeleteDirectory(testDir, fs) should, shouldErr := step.ShouldDo(ctx) extraSteps, doErr := step.Do(ctx) + verifyErr := step.Verify(ctx) - assert.NoError(t, shouldErr) - assert.False(t, should) - assert.NoError(t, doErr) - assert.Empty(t, extraSteps) + g.Expect(should).To(g.BeFalse()) + g.Expect(shouldErr).To(g.BeNil()) + g.Expect(doErr).To(g.BeNil()) + g.Expect(extraSteps).To(g.BeEmpty()) + g.Expect(verifyErr).To(g.BeNil()) } func TestDeleteDirectory_Exists(t *testing.T) { - gomega.RegisterTestingT(t) + g.RegisterTestingT(t) testDir := "/test/or/not-to-test" @@ -42,9 +43,11 @@ func TestDeleteDirectory_Exists(t *testing.T) { step := runtime.NewDeleteDirectory(testDir, fs) should, shouldErr := step.ShouldDo(ctx) extraSteps, doErr := step.Do(ctx) + verifyErr := step.Verify(ctx) - assert.NoError(t, shouldErr) - assert.True(t, should) - assert.NoError(t, doErr) - assert.Empty(t, extraSteps) + g.Expect(should).To(g.BeTrue()) + g.Expect(shouldErr).To(g.BeNil()) + g.Expect(doErr).To(g.BeNil()) + g.Expect(extraSteps).To(g.BeEmpty()) + g.Expect(verifyErr).To(g.BeNil()) } diff --git a/core/steps/runtime/initrd_mount_test.go b/core/steps/runtime/initrd_mount_test.go index 0e6887b7b..65b6efe30 100644 --- a/core/steps/runtime/initrd_mount_test.go +++ b/core/steps/runtime/initrd_mount_test.go @@ -84,6 +84,9 @@ func TestInitrdMount(t *testing.T) { g.Expect(vm.Status.InitrdMount).To( g.BeEquivalentTo(&expectedMount), ) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestInitrdMount_noInitrd(t *testing.T) { @@ -103,6 +106,9 @@ func TestInitrdMount_noInitrd(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestInitrdMount_statusAlreadySet(t *testing.T) { @@ -151,6 +157,9 @@ func TestInitrdMount_statusAlreadySet(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestInitrdMount_vmNotSet(t *testing.T) { @@ -171,6 +180,9 @@ func TestInitrdMount_vmNotSet(t *testing.T) { g.Expect(shouldErr).To(g.MatchError(internalerr.ErrSpecRequired)) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrSpecRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestInitrdMount_pullAndMountError(t *testing.T) { @@ -193,6 +205,9 @@ func TestInitrdMount_pullAndMountError(t *testing.T) { g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestInitrdMount_emptyResponse(t *testing.T) { @@ -215,4 +230,7 @@ func TestInitrdMount_emptyResponse(t *testing.T) { g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrNoMount)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } diff --git a/core/steps/runtime/kernel_mount_test.go b/core/steps/runtime/kernel_mount_test.go index b2a850181..70d120148 100644 --- a/core/steps/runtime/kernel_mount_test.go +++ b/core/steps/runtime/kernel_mount_test.go @@ -80,6 +80,9 @@ func TestKernelMount(t *testing.T) { g.Expect(vm.Status.KernelMount).To( g.BeEquivalentTo(&expectedMount), ) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestKernelMount_noKernel(t *testing.T) { @@ -103,6 +106,9 @@ func TestKernelMount_noKernel(t *testing.T) { g.Expect(doErr).To(g.MatchError(internalerr.ErrKernelImageRequired)) g.Expect(subSteps).To(g.BeEmpty()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestKernelMount_statusAlreadySet(t *testing.T) { @@ -151,6 +157,9 @@ func TestKernelMount_statusAlreadySet(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestKernelMount_vmNotSet(t *testing.T) { @@ -171,6 +180,9 @@ func TestKernelMount_vmNotSet(t *testing.T) { g.Expect(shouldErr).To(g.MatchError(internalerr.ErrSpecRequired)) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrSpecRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestKernelMount_pullAndMountError(t *testing.T) { @@ -193,6 +205,9 @@ func TestKernelMount_pullAndMountError(t *testing.T) { g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestKernelMount_emptyResponse(t *testing.T) { @@ -215,4 +230,7 @@ func TestKernelMount_emptyResponse(t *testing.T) { g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrNoMount)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } diff --git a/core/steps/runtime/repo_release_test.go b/core/steps/runtime/repo_release_test.go index 61d0de0ec..652d64f6a 100644 --- a/core/steps/runtime/repo_release_test.go +++ b/core/steps/runtime/repo_release_test.go @@ -62,6 +62,9 @@ func TestNewRepoRelease(t *testing.T) { g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestNewRepoRelease_doesNotExist(t *testing.T) { @@ -84,6 +87,9 @@ func TestNewRepoRelease_doesNotExist(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestNewRepoRelease_VMIsNotDefined(t *testing.T) { @@ -105,6 +111,9 @@ func TestNewRepoRelease_VMIsNotDefined(t *testing.T) { g.Expect(shouldErr).To(g.MatchError(internalerrors.ErrSpecRequired)) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerrors.ErrSpecRequired)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestNewRepoRelease_existsCheckFails(t *testing.T) { @@ -127,6 +136,9 @@ func TestNewRepoRelease_existsCheckFails(t *testing.T) { g.Expect(shouldDo).To(g.BeFalse()) g.Expect(shouldErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestNewRepoRelease_repoServiceError(t *testing.T) { @@ -157,4 +169,7 @@ func TestNewRepoRelease_repoServiceError(t *testing.T) { g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).ToNot(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } diff --git a/core/steps/runtime/volume_mount_test.go b/core/steps/runtime/volume_mount_test.go index 852104311..af0d0c984 100644 --- a/core/steps/runtime/volume_mount_test.go +++ b/core/steps/runtime/volume_mount_test.go @@ -103,6 +103,9 @@ func TestVolumeMount(t *testing.T) { g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } g.Expect(vm.Status.Volumes).To(g.HaveLen(2)) @@ -148,6 +151,9 @@ func TestVolumeMount_statusAlreadySetBoth(t *testing.T) { g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } g.Expect(vm.Status.Volumes).To(g.HaveLen(2)) @@ -203,6 +209,9 @@ func TestVolumeMount_retry(t *testing.T) { g.Expect(shouldErr).To(g.BeNil()) g.Expect(subSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.BeNil()) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } g.Expect(vm.Status.Volumes).To(g.HaveLen(2)) @@ -283,6 +292,9 @@ func TestVolumeMount_doError(t *testing.T) { g.Expect(extraSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrNoVolumeMount)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) } func TestVolumeMount_nilStatus(t *testing.T) { @@ -309,4 +321,7 @@ func TestVolumeMount_nilStatus(t *testing.T) { g.Expect(extraSteps).To(g.BeEmpty()) g.Expect(doErr).To(g.MatchError(internalerr.ErrMissingStatusInfo)) + + verifyErr := step.Verify(ctx) + g.Expect(verifyErr).To(g.BeNil()) }