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

🏃 util/tests: standardize gomega imports #2681

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

cpanato
Copy link
Member

@cpanato cpanato commented Mar 14, 2020

What this PR does / why we need it:
standardize gomega imports for util/*/*** tests
will 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 14, 2020
@cpanato
Copy link
Member Author

cpanato commented Mar 14, 2020

I think this was the last batch, however, when all PRs get merged i will review the tree once again

util/kubeconfig/kubeconfig_test.go Outdated Show resolved Hide resolved
util/kubeconfig/kubeconfig_test.go Outdated Show resolved Hide resolved
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))
Copy link
Contributor

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

Suggested change
g.Expect(actualConfig.Contexts).To(Equal(tc.expectedConfig.Contexts))
g.Expect(actualConfig.Contexts).To(ConsistOf(tc.expectedConfig.Contexts))

Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Contributor

@JoelSpeed JoelSpeed left a 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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 16, 2020
Copy link
Member

@vincepri vincepri left a 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

@k8s-ci-robot k8s-ci-robot added this to the v0.3.1 milestone Mar 16, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2020
@k8s-ci-robot k8s-ci-robot merged commit 1d5ae9d into kubernetes-sigs:master Mar 16, 2020
@cpanato cpanato deleted the GH-2433-13 branch March 16, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants