Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix tests #135

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading