diff options
author | Ed Santiago <santiago@redhat.com> | 2021-12-01 08:49:55 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2021-12-02 07:54:53 -0700 |
commit | c0a8814fb4d55a950ebf2b2c48731ac939318d7e (patch) | |
tree | de7c1c548a5b9486333fe6417bbb659d28dbec33 /test/e2e/generate_kube_test.go | |
parent | 92f9e117670bb060307aadbd6bdeee303923091c (diff) | |
download | podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.gz podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.bz2 podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.zip |
Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/generate_kube_test.go')
-rw-r--r-- | test/e2e/generate_kube_test.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 2214f2a95..cfa264de2 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -137,12 +137,12 @@ var _ = Describe("Podman generate kube", func() { // Separate out the Service and Pod yaml arr := strings.Split(string(kube.Out.Contents()), "---") - Expect(len(arr)).To(Equal(2)) + Expect(arr).To(HaveLen(2)) svc := new(v1.Service) err := yaml.Unmarshal([]byte(arr[0]), svc) Expect(err).To(BeNil()) - Expect(len(svc.Spec.Ports)).To(Equal(1)) + Expect(svc.Spec.Ports).To(HaveLen(1)) Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(3890)) pod := new(v1.Pod) @@ -324,7 +324,7 @@ var _ = Describe("Podman generate kube", func() { pod := new(v1.Pod) err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) - Expect(len(pod.Spec.HostAliases)).To(Equal(2)) + Expect(pod.Spec.HostAliases).To(HaveLen(2)) Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP)) Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP)) }) @@ -340,12 +340,12 @@ var _ = Describe("Podman generate kube", func() { // Separate out the Service and Pod yaml arr := strings.Split(string(kube.Out.Contents()), "---") - Expect(len(arr)).To(Equal(2)) + Expect(arr).To(HaveLen(2)) svc := new(v1.Service) err := yaml.Unmarshal([]byte(arr[0]), svc) Expect(err).To(BeNil()) - Expect(len(svc.Spec.Ports)).To(Equal(1)) + Expect(svc.Spec.Ports).To(HaveLen(1)) Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(4000)) Expect(svc.Spec.Ports[0].Protocol).To(Equal(v1.ProtocolUDP)) @@ -504,8 +504,8 @@ var _ = Describe("Podman generate kube", func() { Expect(err).To(BeNil()) containers := pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) - Expect(len(containers[0].Ports)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) + Expect(containers[0].Ports).To(HaveLen(1)) Expect(containers[0].Ports[0].Protocol).To(Equal(v1.ProtocolUDP)) }) @@ -641,7 +641,7 @@ var _ = Describe("Podman generate kube", func() { err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) - Expect(len(pod.Spec.Volumes)).To(Equal(2)) + Expect(pod.Spec.Volumes).To(HaveLen(2)) }) @@ -839,7 +839,7 @@ var _ = Describe("Podman generate kube", func() { Expect(err).To(BeNil()) containers := pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].Command).To(Equal([]string{"/bin/sleep"})) Expect(containers[0].Args).To(Equal([]string{"10s"})) @@ -861,7 +861,7 @@ var _ = Describe("Podman generate kube", func() { Expect(err).To(BeNil()) containers := pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].Command).To(BeEmpty()) cmd := []string{"echo", "hi"} @@ -880,7 +880,7 @@ var _ = Describe("Podman generate kube", func() { Expect(err).To(BeNil()) containers = pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].Command).To(Equal(cmd)) }) @@ -915,7 +915,7 @@ ENTRYPOINT ["sleep"]` Expect(err).To(BeNil()) containers := pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].Args).To(Equal([]string{"10s"})) session = podmanTest.Podman([]string{"create", "--pod", "new:testpod-2", "--entrypoint", "echo", image, "hello"}) @@ -933,7 +933,7 @@ ENTRYPOINT ["sleep"]` Expect(err).To(BeNil()) containers = pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].Command).To(Equal([]string{"echo"})) Expect(containers[0].Args).To(Equal([]string{"hello"})) }) @@ -953,7 +953,7 @@ ENTRYPOINT ["sleep"]` Expect(err).To(BeNil()) containers := pod.Spec.Containers - Expect(len(containers)).To(Equal(1)) + Expect(containers).To(HaveLen(1)) Expect(containers[0].SecurityContext.Capabilities).To(BeNil()) // Now make sure we can also `play` it. |