Skip to content

Commit

Permalink
Hotfix tests (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlandowner authored Aug 15, 2024
1 parent 59ba926 commit f6ae268
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ integ-test-kong:

.PHONY: integ-test-fail
integ-test-fail: install-dev-bin
-helm chartsnap --chart example/app1 --namespace default $(ARGS)
-helm chartsnap --chart example/app1 --namespace default -f example/app1/testfail/test_ingress_enabled.yaml $(ARGS)
-helm chartsnap --chart example/app1 --namespace default -f example/app1/testfail/ $(ARGS)
helm chartsnap --chart example/app1 --namespace default $(ARGS) && (echo "should fail"; exit 1) || (echo "--- fail is expected ---"; true)
helm chartsnap --chart example/app1 --namespace default -f example/app1/testfail/test_ingress_enabled.yaml $(ARGS) && (echo "should fail"; exit 1) || (echo "--- fail is expected ---"; true)
helm chartsnap --chart example/app1 --namespace default -f example/app1/testfail/ $(ARGS) && (echo "should fail"; exit 1) || (echo "--- fail is expected ---"; true)

.PHONY: update-versions
update-versions:
Expand Down
2 changes: 1 addition & 1 deletion __snapshots__/main_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ SnapShot = 'snapshot does not match chart=example/app1 values=example/app1/testf

['rootCmd fail values file not found should fail 1']
SnapShot = """
values file 'example/app1/test/notfound.yaml' not found"""
values file 'example/app1/test_latest/notfound.yaml' not found"""
12 changes: 6 additions & 6 deletions hack/helm-template-diff/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ func main() {
helm: "helm template chartsnap ../../example/app1 -n default",
},
{
snap: "../../example/app1/test/__snapshots__/test_ingress_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test/test_ingress_enabled.yaml -n default",
snap: "../../example/app1/test_latest/__snapshots__/test_ingress_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test_latest/test_ingress_enabled.yaml -n default",
},
{
snap: "../../example/app1/test/__snapshots__/test_hpa_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test/test_hpa_enabled.yaml -n default",
snap: "../../example/app1/test_latest/__snapshots__/test_hpa_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test_latest/test_hpa_enabled.yaml -n default",
},
{
snap: "../../example/app1/test/__snapshots__/test_certmanager_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test/test_certmanager_enabled.yaml -n default",
snap: "../../example/app1/test_latest/__snapshots__/test_certmanager_enabled.snap",
helm: "helm template chartsnap ../../example/app1 -f ../../example/app1/test_latest/test_certmanager_enabled.yaml -n default",
},
{
snap: "../../example/remote/__snapshots__/nginx-gateway-fabric.values.snap",
Expand Down
8 changes: 4 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ var _ = Describe("rootCmd", func() {
Context("success", func() {
Context("snapshot local chart with single values file", func() {
It("should pass", func() {
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test/test_ingress_enabled.yaml", "--namespace", "default"})
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test_latest/test_ingress_enabled.yaml", "--namespace", "default"})
err := rootCmd.Execute()
Expect(err).ShouldNot(HaveOccurred())
})
})

Context("snapshot local chart with values directory", func() {
It("should pass", func() {
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test/", "--namespace", "default"})
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test_latest/", "--namespace", "default"})
err := rootCmd.Execute()
Expect(err).ShouldNot(HaveOccurred())
})
Expand Down Expand Up @@ -124,7 +124,7 @@ var _ = Describe("rootCmd", func() {

Context("values file not found", func() {
It("should fail", func() {
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test/notfound.yaml", "--namespace", "default"})
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test_latest/notfound.yaml", "--namespace", "default"})
err := rootCmd.Execute()
Expect(err).To(HaveOccurred())
Ω(err.Error()).To(MatchSnapShot())
Expand All @@ -151,7 +151,7 @@ var _ = Describe("rootCmd", func() {

Context("invalid flag", func() {
It("should fail", func() {
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test/test_ingress_enabled.yaml", "--namespace", "default", "--invalid"})
rootCmd.SetArgs([]string{"--chart", "example/app1", "-f", "example/app1/test_latest/test_ingress_enabled.yaml", "--namespace", "default", "--invalid"})
err := rootCmd.Execute()
Expect(err).To(HaveOccurred())
Ω(err.Error()).To(MatchSnapShot())
Expand Down

0 comments on commit f6ae268

Please sign in to comment.