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 1767156: Fix "Multipleavailable" reason in the code #248

Merged
merged 1 commit into from Nov 7, 2019

Conversation

sohankunkerkar
Copy link
Member

I have come up with this change after having some discussion around the Bugzilla with @stlaz.

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 5, 2019
@sohankunkerkar sohankunkerkar changed the title Bug 1767156 Fix "Multipleavailable" reason in the code WIP Bug 1767156 Fix "Multipleavailable" reason in the code Nov 5, 2019
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 5, 2019
Comment on lines 397 to 400
actualReasons := strings.Split(condition.Reason, "\n")
a := make([]string, len(tc.expectedReasons))
b := make([]string, len(actualReasons))
copy(a, tc.expectedReasons)
copy(b, actualReasons)
sort.Strings(a)
sort.Strings(b)
if !equality.Semantic.DeepEqual(a, b) {
t.Error("\n" + diff.ObjectDiff(a, b))
}
Copy link
Member

Choose a reason for hiding this comment

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

Why not to compare this as strings instead? You know what those should look like

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I understood what's missing here. I should have used sort function only expectedReasons array because the actualReasons array would already be in sorted order.

expectedReason: "Multiple",
name: "MultipleAPIServiceNotAvailable",
expectedStatus: operatorv1.ConditionFalse,
expectedReasons: []string{"APIServiceNotAvailable1", "APIServiceNotAvailable2"},
Copy link
Member

Choose a reason for hiding this comment

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

These don't get indexed in the code so this will never pass. Omit the numbers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@sohankunkerkar
Copy link
Member Author

/test e2e-aws-operator

@sohankunkerkar sohankunkerkar changed the title WIP Bug 1767156 Fix "Multipleavailable" reason in the code Bug 1767156 Fix "Multipleavailable" reason in the code Nov 6, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 6, 2019
Copy link
Member

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

The changes lgtm, but please squash your commits to a single one.

@sohankunkerkar
Copy link
Member Author

The changes lgtm, but please squash your commits to a single one.

Done!. Thanks for reviewing.

@stlaz
Copy link
Member

stlaz commented Nov 7, 2019

/retitle Bug 1767156: Fix "Multipleavailable" reason in the code

@openshift-ci-robot openshift-ci-robot changed the title Bug 1767156 Fix "Multipleavailable" reason in the code Bug 1767156: Fix "Multipleavailable" reason in the code Nov 7, 2019
@openshift-ci-robot
Copy link

@sohankunkerkar: This pull request references Bugzilla bug 1767156, 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.

In response to this:

Bug 1767156: Fix "Multipleavailable" reason in the code

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Nov 7, 2019
@stlaz
Copy link
Member

stlaz commented Nov 7, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
var availableConditionMessages []string

switch {
case actualDaemonSet == nil:
availableConditionReason = "NoDaemon"
availableConditionReasons = append(availableConditionReasons, "NoDaemon")
Copy link
Contributor

Choose a reason for hiding this comment

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

messy. We should have a condition for each one. I think this good enough to backport, but in 4.3, they should be individual and we should clear the existing "Available".

@deads2k
Copy link
Contributor

deads2k commented Nov 7, 2019

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, sohankunkerkar, soltysh, stlaz

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 7, 2019
@openshift-merge-robot openshift-merge-robot merged commit 20d93a2 into openshift:master Nov 7, 2019
@openshift-ci-robot
Copy link

@sohankunkerkar: All pull requests linked via external trackers have merged. Bugzilla bug 1767156 has been moved to the MODIFIED state.

In response to this:

Bug 1767156: Fix "Multipleavailable" reason in the code

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.

@stlaz
Copy link
Member

stlaz commented Nov 12, 2019

/cherrypick release-4.2
/cherrypick release-4.1

@openshift-cherrypick-robot

@stlaz: new pull request created: #254

In response to this:

/cherrypick release-4.2
/cherrypick release-4.1

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.

@stlaz
Copy link
Member

stlaz commented Nov 12, 2019

/cherrypick release-4.1

@openshift-cherrypick-robot

@stlaz: new pull request created: #255

In response to this:

/cherrypick release-4.1

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.

switch {
case len(availableConditionMessages) == 1:
v1helpers.SetOperatorCondition(&operatorConfig.Status.Conditions, operatorv1.OperatorCondition{
Type: operatorv1.OperatorStatusTypeAvailable,
Status: operatorv1.ConditionFalse,
Reason: availableConditionReason,
Reason: availableConditionReasons[0],
Copy link
Contributor

Choose a reason for hiding this comment

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

this panics

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/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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants