diff --git a/pkg/common/utils/k8s/client_test.go b/pkg/common/utils/k8s/client_test.go index ab62cbd4..284f3cc0 100644 --- a/pkg/common/utils/k8s/client_test.go +++ b/pkg/common/utils/k8s/client_test.go @@ -18,6 +18,8 @@ package k8s import ( "context" + "testing" + "github.com/FoundationDB/fdb-kubernetes-operator/api/v1beta2" "github.com/apache/doris-operator/pkg/common/utils/resource" appv1 "k8s.io/api/apps/v1" @@ -28,7 +30,6 @@ import ( "k8s.io/utils/pointer" client "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - "testing" ) func Test_ApplyService(t *testing.T) { @@ -95,14 +96,18 @@ func Test_ApplyStatefulSet(t *testing.T) { fakeClient := fake.NewClientBuilder().WithObjects(svcs...).Build() tsts := []*appv1.StatefulSet{ - &appv1.StatefulSet{ + { ObjectMeta: metav1.ObjectMeta{ Name: "testnoexist", Namespace: "test", }, - Spec: appv1.StatefulSetSpec{}, + Spec: appv1.StatefulSetSpec{ + Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"namespace": "test", "name": "testnoexist"}}, + Replicas: pointer.Int32(1), + Template: corev1.PodTemplateSpec{Spec: corev1.PodSpec{Containers: []corev1.Container{{Name: "fe", Image: "test"}}}}, + }, }, - &appv1.StatefulSet{ + { ObjectMeta: metav1.ObjectMeta{ Name: "test2", Namespace: "test",