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

Fix velerobackup tests for DeepEquals #1415

Merged

Conversation

2uasimojo
Copy link
Member

Several tests were using DeepEquals (under testify's assert.Equal) to compare a runtime.Object from the (fake) kube server to a locally-constructed expected value. This is brittle, as fields such as ResourceVersion cannot be relied on to have predictable values.

Commit c7d6052 in #1407 worked around the problem by explicitly setting the ResourceVersion to the value set by the fake kube server in controller-runtime 0.8.x. This PR has two commits:

  • Revert that workaround;
  • Switch to a comparison that disregards ResourceVersion and TypeMeta.

@openshift-ci openshift-ci bot requested review from akhil-rane and twiest June 9, 2021 21:33
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 9, 2021
@2uasimojo
Copy link
Member Author

2uasimojo commented Jun 9, 2021

Note to reviewers: Ignore the first two commits. Their PRs (#1410, #1414) are approved and pending merge, so I stacked this up to make the subsequent rebase clean.

@2uasimojo
Copy link
Member Author

/assign @dgoodwin

@dgoodwin
Copy link
Contributor

Looks great ty for cleaning this up.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2021
This is a partial revert of c7d6052, which worked around a [breaking
change in controller-runtime 0.8.0](kubernetes-sigs/controller-runtime#1306).

A subsequent commit will fix the tests to disregard ResourceVersion.
Several tests were using DeepEquals (under testify's `assert.Equal`) to
compare a runtime.Object from the (fake) kube server to a
locally-constructed expected value. This is brittle, as fields such as
ResourceVersion cannot be relied on to have predictable values. With
this commit, we switch to a comparison that disregards ResourceVersion
and TypeMeta.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2021
@dgoodwin
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 10, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, dgoodwin

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

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 21015af into openshift:master Jun 11, 2021
@2uasimojo 2uasimojo deleted the velero-mostly-equals branch June 11, 2021 15:38
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants