Skip to content

Commit

Permalink
add tests for sorted list of etcd args
Browse files Browse the repository at this point in the history
  • Loading branch information
sircthulhu committed Jul 3, 2024
1 parent 3db5163 commit 0057597
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/controller/factory/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package factory

import (
"slices"

"github.com/google/uuid"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -172,10 +174,19 @@ var _ = Describe("CreateOrUpdateStatefulSet handler", func() {
Expect(statefulSet.Spec.Template.ObjectMeta.Annotations).To(Equal(etcdcluster.Spec.PodTemplate.Annotations))
})

By("Checking the extraArgs", func() {
By("Checking the command", func() {
Expect(statefulSet.Spec.Template.Spec.Containers[0].Command).To(Equal(generateEtcdCommand()))
})

By("Checking the extraArgs", func() {
Expect(statefulSet.Spec.Template.Spec.Containers[0].Args).To(Equal(generateEtcdArgs(&etcdcluster)))
By("Checking args are sorted", func() {
argsClone := slices.Clone(statefulSet.Spec.Template.Spec.Containers[0].Args)
slices.Sort(argsClone)
Expect(statefulSet.Spec.Template.Spec.Containers[0].Args).To(Equal(argsClone))
})
})

By("Checking the readinessGates", func() {
Expect(statefulSet.Spec.Template.Spec.ReadinessGates).To(Equal(etcdcluster.Spec.PodTemplate.Spec.ReadinessGates))
})
Expand Down

0 comments on commit 0057597

Please sign in to comment.