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

🐛 Remove exact path match from walkTemplate test #8019

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func Test_WalkTemplates(t *testing.T) {
CommonResponse: runtimehooksv1.CommonResponse{
Status: runtimehooksv1.ResponseStatusFailure,
Message: "no kind \"Unknown\" is registered for version \"controlplane.cluster.x-k8s." +
"io/v1beta1\" in scheme \"pkg/runtime/scheme.go:100\"",
Copy link
Contributor Author

@killianmuldoon killianmuldoon Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue was reported in slack where the path reported was "go/pkg/runtime.scheme.go". This can be safely changed without losing coverage. I'm currently digging to the bottom of how the path is generated to see why it might have ended up different here.

@mtougeron it would be great if you could outline how you had the packages set up, or whether this issue is hitting you on a clean main repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on MacOS

$> pwd
/Users/tougeron/src/go/src/github.com/mtougeron/cluster-api
$> env | grep GO
GOPATH=/Users/tougeron/src/go

FWIW, I just tried without setting my GOPATH and it worked as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - I wonder if any other tests are dependent on using go modules 🤔

"io/v1beta1\" in scheme",
},
},
options: []WalkTemplatesOption{
Expand Down Expand Up @@ -225,7 +225,7 @@ func Test_WalkTemplates(t *testing.T) {
WalkTemplates(context.Background(), decoder, request, response, mutatingFunc, tt.options...)

g.Expect(response.Status).To(Equal(tt.expectedResponse.Status))
g.Expect(response.Message).To(Equal(tt.expectedResponse.Message))
g.Expect(response.Message).To(ContainSubstring(tt.expectedResponse.Message))
for i, item := range response.Items {
expectedItem := tt.expectedResponse.Items[i]
g.Expect(item.PatchType).To(Equal(expectedItem.PatchType))
Expand Down