diff --git a/pkg/fio/fio.go b/pkg/fio/fio.go index 69e4e7b..2cecdd0 100644 --- a/pkg/fio/fio.go +++ b/pkg/fio/fio.go @@ -134,12 +134,12 @@ func (f *FIOrunner) RunFioHelper(ctx context.Context, args *RunFIOArgs) (*RunFIO fmt.Println("PVC created", pvc.Name) pod, err := f.fioSteps.createPod(ctx, pvc.Name, configMap.Name, testFileName, args.Namespace, args.Image) - defer func() { - _ = f.fioSteps.deletePod(context.TODO(), pod.Name, args.Namespace) - }() if err != nil { return nil, errors.Wrap(err, "Failed to create POD") } + defer func() { + _ = f.fioSteps.deletePod(context.TODO(), pod.Name, args.Namespace) + }() fmt.Println("Pod created", pod.Name) fmt.Printf("Running FIO test (%s) on StorageClass (%s) with a PVC of Size (%s)\n", testFileName, args.StorageClass, args.Size) fioOutput, err := f.fioSteps.runFIOCommand(ctx, pod.Name, ContainerName, testFileName, args.Namespace) diff --git a/pkg/fio/fio_test.go b/pkg/fio/fio_test.go index 7a36a8e..f53d1f3 100644 --- a/pkg/fio/fio_test.go +++ b/pkg/fio/fio_test.go @@ -194,7 +194,7 @@ func (s *FIOTestSuite) TestRunFioHelper(c *C) { Namespace: "foo", }, checker: NotNil, - expectedSteps: []string{"VN", "SCE", "LCM", "CPVC", "CPOD", "DPOD", "DPVC", "DCM"}, + expectedSteps: []string{"VN", "SCE", "LCM", "CPVC", "CPOD", "DPVC", "DCM"}, }, { // create PVC error cli: fake.NewSimpleClientset(),