mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 19:54:00 +00:00
lint(ginkgolinter): expect (not)to HaveOccurred (#7565)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -141,7 +141,7 @@ var _ = Describe("PodVolumeBackup Reconciler", func() {
|
||||
// `now` will be used to set the fake clock's time; capture
|
||||
// it here so it can be referenced in the test case defs.
|
||||
now, err := time.Parse(time.RFC1123, time.RFC1123)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
now = now.Local()
|
||||
|
||||
DescribeTable("a pod volume backup",
|
||||
@@ -150,21 +150,21 @@ var _ = Describe("PodVolumeBackup Reconciler", func() {
|
||||
|
||||
fakeClient := fake.NewClientBuilder().WithScheme(scheme.Scheme).Build()
|
||||
err = fakeClient.Create(ctx, test.pvb)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = fakeClient.Create(ctx, test.pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = fakeClient.Create(ctx, test.bsl)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = fakeClient.Create(ctx, test.backupRepo)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
fakeFS := velerotest.NewFakeFileSystem()
|
||||
pathGlob := fmt.Sprintf("/host_pods/%s/volumes/*/%s", "", "pvb-1-volume")
|
||||
_, err = fakeFS.Create(pathGlob)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
credentialFileStore, err := credentials.NewNamespacedFileStore(
|
||||
fakeClient,
|
||||
@@ -173,7 +173,7 @@ var _ = Describe("PodVolumeBackup Reconciler", func() {
|
||||
fakeFS,
|
||||
)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if test.dataMgr == nil {
|
||||
test.dataMgr = datapath.NewManager(1)
|
||||
@@ -208,7 +208,7 @@ var _ = Describe("PodVolumeBackup Reconciler", func() {
|
||||
})
|
||||
Expect(actualResult).To(BeEquivalentTo(test.expectedRequeue))
|
||||
if test.expectedErrMsg == "" {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
} else {
|
||||
Expect(err.Error()).To(BeEquivalentTo(test.expectedErrMsg))
|
||||
}
|
||||
@@ -222,7 +222,7 @@ var _ = Describe("PodVolumeBackup Reconciler", func() {
|
||||
if test.expected == nil {
|
||||
Expect(apierrors.IsNotFound(err)).To(BeTrue())
|
||||
} else {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Eventually(pvb.Status.Phase).Should(Equal(test.expected.Status.Phase))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user