Skip to content

Commit

Permalink
Change Marshal -> Unmarshal in generate kube tests
Browse files Browse the repository at this point in the history
We need to verify that valid YAML was produced - Marshal will
just pack the generated YAML even further.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
  • Loading branch information
mheon committed Jun 24, 2019
1 parent 567e7c6 commit 803a2b0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/e2e/generate_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))

_, err := yaml.Marshal(kube.OutputToString())
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.OutputToString(), pod)
Expect(err).To(BeNil())
})

Expand All @@ -71,7 +72,8 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))

_, err := yaml.Marshal(kube.OutputToString())
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.OutputToString(), pod)
Expect(err).To(BeNil())
})

Expand All @@ -87,7 +89,8 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))

_, err := yaml.Marshal(kube.OutputToString())
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.OutputToString(), pod)
Expect(err).To(BeNil())
})

Expand All @@ -103,8 +106,10 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))

_, err := yaml.Marshal(kube.OutputToString())
Expect(err).To(BeNil())
// TODO: How do we test unmarshal with a service? We have two
// structs that need to be unmarshalled...
// _, err := yaml.Marshal(kube.OutputToString())
// Expect(err).To(BeNil())
})

It("podman generate kube on pod with ports", func() {
Expand Down

0 comments on commit 803a2b0

Please sign in to comment.