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

Bug 1889721: add skippatch unit test #505

Merged

Conversation

ankitathomas
Copy link
Contributor

Adding unit tests for isSkipPatchCandidate

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Nov 3, 2020
@openshift-ci-robot
Copy link

@ankitathomas: This pull request references Bugzilla bug 1889721, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1889721: add skippatch unit test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

expected: true,
},
{
name: "accept patch version without pre-release",

Choose a reason for hiding this comment

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

@ankitathomas if it is the following data,

{
			name: "do not accept patch version with pre-release",
			added: "0.0.0-1",
			compare: "0.0.0",
			expected: false,
		},

is it correct? I think so. thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

@ankitathomas To add on to this, if f(a, c) -> !f(c, a) and !f(a, c) -> f(c, a), then this test could automatically verify both for each case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added checking for the absence of a commutative edge

Comment on lines 330 to 335
{
name: "do not accept different major/minor version",
added: "0.0.0",
compare: "0.0.0",
expected: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you meant to change the inputs for this case?

pkg/registry/bundlegraphloader_test.go Show resolved Hide resolved
expected: true,
},
{
name: "accept patch version without pre-release",
Copy link
Contributor

Choose a reason for hiding this comment

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

@ankitathomas To add on to this, if f(a, c) -> !f(c, a) and !f(a, c) -> f(c, a), then this test could automatically verify both for each case.

@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@d8243c5). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #505   +/-   ##
=========================================
  Coverage          ?   48.73%           
=========================================
  Files             ?       90           
  Lines             ?     6103           
  Branches          ?        0           
=========================================
  Hits              ?     2974           
  Misses            ?     2469           
  Partials          ?      660           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8243c5...6d94e8e. Read the comment docs.

Copy link
Contributor

@benluddy benluddy left a comment

Choose a reason for hiding this comment

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

/approve

actual := isSkipPatchCandidate(added, compare)
assert.Equal(t, tt.expected, actual)

if !tt.commutative {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I see it (and recognize that there are cases that don't have this property), I'm not sure that adding a second assertion to the test is better than explicitly writing these cases. I won't ask you to change it again if you disagree, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can make this assertion whenever we have a valid skippatch pair. f(a, c) -> !f(c, a) holds true, so this should cover all the cases we need

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ankitathomas, benluddy

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 11, 2020
@ankitathomas ankitathomas requested review from benluddy and anik120 and removed request for jmrodri, benluddy and estroz November 11, 2020 18:34
@kevinrizza
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2020
@openshift-bot
Copy link
Contributor

/retest

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

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 5858f6f into operator-framework:master Nov 13, 2020
@openshift-ci-robot
Copy link

@ankitathomas: All pull requests linked via external trackers have merged:

Bugzilla bug 1889721 has been moved to the MODIFIED state.

In response to this:

Bug 1889721: add skippatch unit test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

ankitathomas pushed a commit to openshift-cherrypick-robot/operator-registry that referenced this pull request Nov 20, 2020
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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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

7 participants