diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-06-25 11:15:03 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-06-25 12:34:53 -0400 |
commit | 068d3bb3bfe4fb68fee6ecbef13469e36e4a9a04 (patch) | |
tree | 6a534331098b2bfe8ed344782ebab987aa385fc0 /test | |
parent | 101a5cd7556433f81238032bf9c44bbbb6b4cabc (diff) | |
download | podman-068d3bb3bfe4fb68fee6ecbef13469e36e4a9a04.tar.gz podman-068d3bb3bfe4fb68fee6ecbef13469e36e4a9a04.tar.bz2 podman-068d3bb3bfe4fb68fee6ecbef13469e36e4a9a04.zip |
Update 'generate kube' tests to verify YAML
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/generate_kube_test.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index a51b42d9a..1df54f753 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -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() { |