Update 'generate kube' tests to verify YAML
@@ -59,8 +59,14 @@ var _ = Describe("Podman generate kube", func() {
Expect(kube.ExitCode()).To(Equal(0))
pod := new(v1.Pod)
- err := yaml.Unmarshal([]byte(kube.OutputToString()), pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
+
+ numContainers := 0
+ for range pod.Spec.Containers {
+ numContainers = numContainers + 1
+ }
+ Expect(numContainers).To(Equal(1))
})
It("podman generate service kube on container", func() {
@@ -72,9 +78,11 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))
- pod := new(v1.Pod)
- err := yaml.Unmarshal([]byte(kube.OutputToString()), pod)
- Expect(err).To(BeNil())
+ // TODO - test generated YAML - service produces multiple
+ // structs.
+ // pod := new(v1.Pod)
+ // err := yaml.Unmarshal([]byte(kube.OutputToString()), pod)
+ // Expect(err).To(BeNil())
})
It("podman generate kube on pod", func() {
@@ -90,8 +98,14 @@ var _ = Describe("Podman generate kube", func() {
Expect(kube.ExitCode()).To(Equal(0))
pod := new(v1.Pod)
- err := yaml.Unmarshal([]byte(kube.OutputToString()), pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
+
+ numContainers := 0
+ for range pod.Spec.Containers {
+ numContainers = numContainers + 1
+ }
+ Expect(numContainers).To(Equal(1))
})
It("podman generate service kube on pod", func() {
