@@ -22,14 +22,21 @@ import (
2222
2323 . "github.com/onsi/ginkgo/v2"
2424 . "github.com/onsi/gomega"
25- appsv1 " k8s.io/api/apps/v1 "
25+ . "sigs. k8s.io/controller-runtime/pkg/envtest/komega "
2626 corev1 "k8s.io/api/core/v1"
2727 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+ << << << < HEAD
2829 . "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
2930
3031 etcdaenixiov1alpha1 "github.com/aenix-io/etcd-operator/api/v1alpha1"
3132 "github.com/google/uuid"
3233 "k8s.io/apimachinery/pkg/types"
34+ == == == =
35+
36+ etcdaenixiov1alpha1 "github.com/aenix-io/etcd-operator/api/v1alpha1"
37+ "k8s.io/apimachinery/pkg/types"
38+ "github.com/google/uuid"
39+ >> >> >> > 641 ff74 (move reconcileOwnedResource to reconcile utils )
3340)
3441
3542var _ = Describe ("StatefulSet factory" , func () {
@@ -45,14 +52,23 @@ var _ = Describe("StatefulSet factory", func() {
4552 DeferCleanup (k8sClient .Delete , ns )
4653 })
4754
55+ << << << < HEAD
4856 Context ("PodLabels" , func () {
4957 It ("should return base labels with custom labels merged" , func () {
5058 cluster := & etcdaenixiov1alpha1.EtcdCluster {
59+ == == == =
60+ Context ("when create statefulSet" , func () {
61+ var etcdcluster etcdaenixiov1alpha1.EtcdCluster
62+
63+ BeforeEach (func () {
64+ etcdcluster = etcdaenixiov1alpha1.EtcdCluster {
65+ >> >> >> > 641 ff74 (move reconcileOwnedResource to reconcile utils )
5166 ObjectMeta : metav1.ObjectMeta {
5267 Name : "test-cluster" ,
5368 },
5469 Spec : etcdaenixiov1alpha1.EtcdClusterSpec {},
5570 }
71+ << << << < HEAD
5672
5773 cluster .Spec .PodTemplate .Labels = map [string ]string {
5874 "custom-label" : "value" ,
@@ -73,6 +89,19 @@ var _ = Describe("StatefulSet factory", func() {
7389 labels := PodLabels (cluster )
7490 Expect (labels ).Should (HaveLen (3 ))
7591 })
92+ == == == =
93+ Expect (k8sClient .Create (ctx , & etcdcluster )).Should (Succeed ())
94+ Eventually (Get (& etcdcluster )).Should (Succeed ())
95+ DeferCleanup (k8sClient .Delete , & etcdcluster )
96+
97+ })
98+ It ("should successfully create statefulSet object with empty spec" , func (){
99+ statefulSetObj , err := GetStatefulSet (ctx , & etcdcluster , k8sClient )
100+ Expect (err ).ShouldNot (HaveOccurred ())
101+ Expect (statefulSetObj ).ShouldNot (BeNil ())
102+ })
103+
104+ >> >> >> > 641 ff74 (move reconcileOwnedResource to reconcile utils )
76105 })
77106
78107 Context ("GenerateEtcdArgs" , func () {
0 commit comments