Skip to content

Commit

Permalink
fix for misplaced defer (#63)
Browse files Browse the repository at this point in the history
bathina2 authored Apr 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent bbb1341 commit 31d463e
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/fio/fio.go
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pkg/fio/fio_test.go
Original file line number Diff line number Diff line change
@@ -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(),

0 comments on commit 31d463e

Please sign in to comment.