-
Notifications
You must be signed in to change notification settings - Fork 11
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
Unit tests for contour k8sd feature #705
base: main
Are you sure you want to change the base?
Conversation
adresses also KU-1516 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @maci3jka! LGTM, great stuff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Left some comments
g.Expect(err.Error()).To(ContainSubstring(applyErr.Error())) | ||
g.Expect(status.Enabled).To(BeFalse()) | ||
g.Expect(status.Version).To(Equal(contour.ContourGatewayProvisionerContourImageTag)) | ||
g.Expect(status.Message).To(ContainSubstring("Failed to delete Contour Gateway")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g.Expect(status.Message).To(ContainSubstring("Failed to delete Contour Gateway")) | |
g.Expect(status.Message).To(Equal(fmt.Sprintf(gatewayDeleteFailedMsgTmpl, err))) |
I believe we can just use the err
returned from ApplyGateway
to construct the entire status.Message
.
projectcontour := values["projectcontour"].(map[string]any)["image"].(map[string]any) | ||
g.Expect(projectcontour["repository"]).To(Equal(contour.ContourGatewayProvisionerContourImageRepo)) | ||
g.Expect(projectcontour["tag"]).To(Equal(contour.ContourGatewayProvisionerContourImageTag)) | ||
envoy := values["envoyproxy"].(map[string]any)["image"].(map[string]any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
envoy := values["envoyproxy"].(map[string]any)["image"].(map[string]any) | |
envoyImage := values["envoyproxy"].(map[string]any)["image"].(map[string]any) |
Also we should check for envoyproxy
and image
to exist first, otherwise we'll do a nil cast/reference.
The unit tests for the contour feature are lacking this pr proves test coverage from 0% files, 0% statements to 100% files, 84.3% statements for github.com/canonical/k8s/pkg/k8sd/features/contour package.