-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🏃 util/tests: standardize gomega imports #2681
Conversation
I think this was the last batch, however, when all PRs get merged i will review the tree once again |
g.Expect(actualConfig.Clusters[tc.cluster]).NotTo(BeNil()) | ||
g.Expect(actualConfig.Contexts[tc.expectedConfig.CurrentContext]).NotTo(BeNil()) | ||
g.Expect(actualConfig.CurrentContext).To(Equal(tc.expectedConfig.CurrentContext)) | ||
g.Expect(actualConfig.Contexts).To(Equal(tc.expectedConfig.Contexts)) |
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.
Could the order vary of actualConfig.Contexts
? Might be better to use ConsistOf
if ordering doesn't matter
g.Expect(actualConfig.Contexts).To(Equal(tc.expectedConfig.Contexts)) | |
g.Expect(actualConfig.Contexts).To(ConsistOf(tc.expectedConfig.Contexts)) |
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.
if use ConsistOf
the test fail
--- FAIL: TestNew (0.29s)
/Users/cpanato/go/src/github.com/kubernetes-sigs/cluster-api/util/kubeconfig/kubeconfig_test.go:180:
Expected
<map[string]*api.Context | len:1>: {
"foo-admin@foo": {
LocationOfOrigin: "",
Cluster: "foo",
AuthInfo: "foo-admin",
Namespace: "",
Extensions: nil,
},
}
to consist of
<[]interface {} | len:1, cap:1>: [
{
"foo-admin@foo": {
LocationOfOrigin: "",
Cluster: "foo",
AuthInfo: "foo-admin",
Namespace: "",
Extensions: nil,
},
},
]
the missing elements were
<[]interface {} | len:1, cap:1>: [
{
"foo-admin@foo": {
LocationOfOrigin: "",
Cluster: "foo",
AuthInfo: "foo-admin",
Namespace: "",
Extensions: nil,
},
},
]
the extra elements were
<[]interface {} | len:1, cap:1>: [
{
LocationOfOrigin: "",
Cluster: "foo",
AuthInfo: "foo-admin",
Namespace: "",
Extensions: nil,
},
]
FAIL
FAIL sigs.k8s.io/cluster-api/util/kubeconfig 0.715s
FAIL
Error: Tests failed.
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.
Ack. Ignore that suggestion 😅 Don't think it works for maps
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.
/lgtm
Thanks for the fixes @cpanato
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.
/approve
/milestone v0.3.1
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
standardize gomega imports for
util/*/***
testswill open other PR for the other folders to make easier the review
/cc @vincepri @detiber
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Related to #2433