-
Notifications
You must be signed in to change notification settings - Fork 453
OTA-1814: fix(alerts): Remove duplicate information in the recommend command #2279
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
Open
nbottari9
wants to merge
11
commits into
openshift:main
Choose a base branch
from
nbottari9:1814-duplicate-warning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,519
−4
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9cb58aa
fix(adm-upgrade): switched to checking for CVO in alerts(). Wrote uni…
nbottari9 55acfea
fix(adm-upgrade-recommend-alerts): moved CVO detection into its own f…
nbottari9 05b6aaa
fix(adm-upgrade-recommend-alerts): extend mockData to include feature…
nbottari9 e61d937
fix(adm-upgrade-recommend-alerts): cleaned up logic
nbottari9 4a2cbfa
added featureGate and infrastructure manifests to ../admin/upgrade/re…
nbottari9 65611b9
fix(adm-upgrade-recommend-alerts): added new mockData test case to te…
nbottari9 a15db87
fix(adm-upgrade-recommend-alerts): test fixtures showing duplicate in…
nbottari9 482fdc1
fix(adm-upgrade-recommend-alerts): duplicate information is gone once…
nbottari9 3355a4a
fix(alerts): remove unnecessary lines and revised comments to better …
nbottari9 ca8e7ec
fix(alerts): added test case for when cvo is not handling risks
nbottari9 67a790f
fix(alerts): fixed specific version number test case and added new me…
nbottari9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| package recommend | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| configv1 "github.com/openshift/api/config/v1" | ||
| "github.com/openshift/api/features" | ||
| ) | ||
|
|
||
| func TestIsAcceptRisksEnabled(t *testing.T) { | ||
|
|
||
| for _, testCase := range []struct { | ||
| name string | ||
| featureGateConfig *configv1.FeatureGate | ||
| expected bool | ||
| }{ | ||
| { | ||
| name: "no feature gates", | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is enabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Enabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expected: true, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is explicitly disabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Disabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is not explicitly enabled or disabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Enabled: []configv1.FeatureGateAttributes{}, | ||
| Disabled: []configv1.FeatureGateAttributes{}, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is enabled for a different cluster version", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.21.0", | ||
| Enabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| } { | ||
| t.Run(testCase.name, func(t *testing.T) { | ||
| actual := isAcceptRisksEnabled(testCase.featureGateConfig, "4.22.0") | ||
|
|
||
| if actual != testCase.expected { | ||
| t.Errorf("%v != %v", actual, testCase.expected) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestIsHypershiftEnabled(t *testing.T) { | ||
| for _, testCase := range []struct { | ||
| name string | ||
| infrastructure *configv1.Infrastructure | ||
| expected bool | ||
| }{ | ||
| { | ||
| name: "no infrastructure", | ||
| }, | ||
| { | ||
| name: "hypershift enabled", | ||
| infrastructure: &configv1.Infrastructure{ | ||
| Status: configv1.InfrastructureStatus{ | ||
| ControlPlaneTopology: configv1.ExternalTopologyMode, | ||
| }, | ||
| }, | ||
| expected: true, | ||
| }, | ||
| { | ||
| name: "hypershift not enabled", | ||
| infrastructure: &configv1.Infrastructure{ | ||
| Status: configv1.InfrastructureStatus{ | ||
| ControlPlaneTopology: configv1.HighlyAvailableTopologyMode, | ||
| }, | ||
| }, | ||
| }, | ||
| } { | ||
| t.Run(testCase.name, func(t *testing.T) { | ||
| actual := isHostedCluster(testCase.infrastructure) | ||
|
|
||
| if actual != testCase.expected { | ||
| t.Errorf("%v != %v", actual, testCase.expected) | ||
| } | ||
| }) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.