Skip to content

Commit f2acad4

Browse files
committed
test(dataset): tighten deletion assertion
Signed-off-by: Harsh <harshmastic@gmail.com>
1 parent 972ba3d commit f2acad4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/controllers/v1alpha1/dataset/dataset_reconciler_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
2828
"github.com/fluid-cloudnative/fluid/pkg/utils/fake"
2929
corev1 "k8s.io/api/core/v1"
30+
apierrors "k8s.io/apimachinery/pkg/api/errors"
3031
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3132
"k8s.io/apimachinery/pkg/runtime"
3233
"k8s.io/apimachinery/pkg/types"
@@ -296,15 +297,9 @@ var _ = Describe("DatasetReconciler (fake client)", func() {
296297
Expect(err).NotTo(HaveOccurred())
297298
Expect(result).To(Equal(ctrl.Result{}))
298299

299-
// After removing finalizer with deletion timestamp, the object is deleted by Kubernetes
300-
// So we verify the finalizer was removed by checking it's no longer in the updates
301-
// The fake client will have deleted the object when finalizer was removed
302300
stored := &datav1alpha1.Dataset{}
303301
getErr := r.Get(ctx, types.NamespacedName{Namespace: "default", Name: "del-clean"}, stored)
304-
// Either the object is deleted (not found) or it exists without the finalizer
305-
if getErr == nil {
306-
Expect(stored.Finalizers).NotTo(ContainElement(finalizer))
307-
}
302+
Expect(apierrors.IsNotFound(getErr)).To(BeTrue())
308303
})
309304

310305
It("requeues when DatasetRef still has live entries", func() {

0 commit comments

Comments
 (0)