-
Notifications
You must be signed in to change notification settings - Fork 217
OTA-1546: Add a serial e2e for accept-risks #1310
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
Merged
openshift-merge-bot
merged 9 commits into
openshift:main
from
hongkailiu:accept-risks-e2e-serial
Feb 14, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a4b7547
Add a serial e2e for accept-risks
hongkailiu 29bc67d
Define constants for external usages
hongkailiu 3245da0
Ensure no dupliated accept risks
hongkailiu beaa548
Use labels to indicate serial tests
hongkailiu 4094de8
Add a comment about fauxinnati
hongkailiu b93bd3c
Check the error before using the CV
hongkailiu 5d564e8
Add more checks after conditional updates are recommended
hongkailiu 993d5e5
Add the comments for the cvo package
hongkailiu dae0f49
Update e2e metadata
hongkailiu 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
12 changes: 12 additions & 0 deletions
12
.openshift-tests-extension/openshift_payload_cluster-version-operator.json
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
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
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,21 @@ | ||
| package external | ||
|
|
||
| import "github.com/openshift/cluster-version-operator/pkg/internal" | ||
|
|
||
| // The constants defined here are used by the components, e.g., e2e tests that have no access | ||
| // to github.com/openshift/cluster-version-operator/pkg/internal | ||
| // See https://pkg.go.dev/cmd/go#hdr-Internal_Directories | ||
| const ( | ||
| // DefaultCVONamespace is the default namespace for the Cluster Version Operator | ||
| DefaultCVONamespace = internal.DefaultCVONamespace | ||
| // DefaultClusterVersionName is the default name for the Cluster Version resource managed by the Cluster Version Operator | ||
| DefaultClusterVersionName = internal.DefaultClusterVersionName | ||
| // DefaultDeploymentName is the default name of the deployment for the Cluster Version Operator | ||
| DefaultDeploymentName = internal.DefaultDeploymentName | ||
| // DefaultContainerName is the default container name in the deployment for the Cluster Version Operator | ||
| DefaultContainerName = internal.DefaultContainerName | ||
|
|
||
| // ConditionalUpdateConditionTypeRecommended is a type of the condition present on a conditional update | ||
| // that indicates whether the conditional update is recommended or not | ||
| ConditionalUpdateConditionTypeRecommended = internal.ConditionalUpdateConditionTypeRecommended | ||
| ) |
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
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,140 @@ | ||
| package cvo | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| g "github.com/onsi/ginkgo/v2" | ||
| o "github.com/onsi/gomega" | ||
|
|
||
| configv1 "github.com/openshift/api/config/v1" | ||
| configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1" | ||
| "k8s.io/apimachinery/pkg/api/meta" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/util/sets" | ||
| "k8s.io/apimachinery/pkg/util/wait" | ||
| "k8s.io/client-go/rest" | ||
|
|
||
| "github.com/openshift/cluster-version-operator/pkg/external" | ||
| "github.com/openshift/cluster-version-operator/test/util" | ||
| ) | ||
|
|
||
| var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, func() { | ||
|
|
||
| var ( | ||
| c *rest.Config | ||
| configClient *configv1client.ConfigV1Client | ||
| err error | ||
|
|
||
| ctx = context.TODO() | ||
| backup configv1.ClusterVersionSpec | ||
| ) | ||
|
|
||
| g.BeforeEach(func() { | ||
| c, err = util.GetRestConfig() | ||
| o.Expect(err).To(o.BeNil()) | ||
| configClient, err = configv1client.NewForConfig(c) | ||
| o.Expect(err).To(o.BeNil()) | ||
|
|
||
| util.SkipIfNotTechPreviewNoUpgrade(ctx, c) | ||
| o.Expect(util.SkipIfHypershift(ctx, c)).To(o.BeNil()) | ||
| o.Expect(util.SkipIfMicroshift(ctx, c)).To(o.BeNil()) | ||
|
|
||
| cv, err := configClient.ClusterVersions().Get(ctx, external.DefaultClusterVersionName, metav1.GetOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| if du := cv.Spec.DesiredUpdate; du != nil { | ||
| logger.WithValues("AcceptRisks", du.AcceptRisks).Info("Accept risks before testing") | ||
| o.Expect(du.AcceptRisks).To(o.BeEmpty(), "found accept risks") | ||
| } | ||
| backup = *cv.Spec.DeepCopy() | ||
| }) | ||
|
|
||
| g.AfterEach(func() { | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cv, err := configClient.ClusterVersions().Get(ctx, external.DefaultClusterVersionName, metav1.GetOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| cv.Spec = backup | ||
| _, err = configClient.ClusterVersions().Update(ctx, cv, metav1.UpdateOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| }) | ||
|
|
||
| g.It("should work with accept risks", g.Label("Serial"), func() { | ||
| cv, err := configClient.ClusterVersions().Get(ctx, external.DefaultClusterVersionName, metav1.GetOptions{}) | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| g.By("Using fauxinnati as the upstream and its risks-always channel") | ||
| cv.Spec.Upstream = util.FauxinnatiAPIURL | ||
| cv.Spec.Channel = "risks-always" | ||
|
|
||
| _, err = configClient.ClusterVersions().Update(ctx, cv, metav1.UpdateOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| g.By("Checking that conditional updates shows up in status") | ||
| // waiting for the conditional updates to show up | ||
| o.Expect(wait.PollUntilContextTimeout(ctx, 30*time.Second, 5*time.Minute, true, func(ctx context.Context) (done bool, err error) { | ||
| cv, err = configClient.ClusterVersions().Get(ctx, external.DefaultClusterVersionName, metav1.GetOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| if len(cv.Status.ConditionalUpdates) == 0 { | ||
| return false, nil | ||
| } | ||
| return true, nil | ||
| })).NotTo(o.HaveOccurred(), "no conditional updates found in status") | ||
|
|
||
| g.By("Checking that no conditional updates are recommended") | ||
| conditionalUpdatesLength := len(cv.Status.ConditionalUpdates) | ||
| var acceptRisks []configv1.AcceptRisk | ||
| var releases []configv1.Release | ||
| names := sets.New[string]() | ||
| for _, cu := range cv.Status.ConditionalUpdates { | ||
| releases = append(releases, cu.Release) | ||
| o.Expect(cu.RiskNames).NotTo(o.BeEmpty()) | ||
| for _, name := range cu.RiskNames { | ||
| if names.Has(name) { | ||
| continue | ||
| } | ||
| names.Insert(name) | ||
| acceptRisks = append(acceptRisks, configv1.AcceptRisk{Name: name}) | ||
| } | ||
| o.Expect(cu.Risks).NotTo(o.BeEmpty()) | ||
| recommendedCondition := meta.FindStatusCondition(cu.Conditions, external.ConditionalUpdateConditionTypeRecommended) | ||
| o.Expect(recommendedCondition).NotTo(o.BeNil()) | ||
| o.Expect(recommendedCondition.Status).To(o.Equal(metav1.ConditionFalse)) | ||
| } | ||
|
|
||
| g.By("Accepting all risks") | ||
| o.Expect(acceptRisks).NotTo(o.BeEmpty()) | ||
| if cv.Spec.DesiredUpdate == nil { | ||
| cv.Spec.DesiredUpdate = &configv1.Update{ | ||
| Image: cv.Status.Desired.Image, | ||
| Version: cv.Status.Desired.Version, | ||
| Architecture: cv.Status.Desired.Architecture, | ||
| } | ||
| } | ||
| cv.Spec.DesiredUpdate.AcceptRisks = acceptRisks | ||
|
|
||
| _, err = configClient.ClusterVersions().Update(ctx, cv, metav1.UpdateOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| g.By("Checking that all conditional updates are recommended") | ||
| var releasesNow []configv1.Release | ||
| // waiting for the conditional updates to be refreshed | ||
| o.Expect(wait.PollUntilContextTimeout(ctx, 30*time.Second, 5*time.Minute, true, func(ctx context.Context) (done bool, err error) { | ||
| cv, err = configClient.ClusterVersions().Get(ctx, external.DefaultClusterVersionName, metav1.GetOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| o.Expect(cv.Status.ConditionalUpdates).NotTo(o.BeEmpty()) | ||
| releasesNow = nil | ||
| for _, cu := range cv.Status.ConditionalUpdates { | ||
| releasesNow = append(releasesNow, cu.Release) | ||
| recommendedCondition := meta.FindStatusCondition(cu.Conditions, external.ConditionalUpdateConditionTypeRecommended) | ||
| o.Expect(recommendedCondition).NotTo(o.BeNil()) | ||
| if recommendedCondition.Status != metav1.ConditionTrue { | ||
| return false, nil | ||
| } | ||
| } | ||
| return true, nil | ||
| })).NotTo(o.HaveOccurred(), "no conditional updates are recommended in status after accepting risks") | ||
|
|
||
| o.Expect(cv.Spec.DesiredUpdate.AcceptRisks).To(o.Equal(acceptRisks)) | ||
| o.Expect(cv.Status.ConditionalUpdates).To(o.HaveLen(conditionalUpdatesLength)) | ||
| o.Expect(releasesNow).To(o.Equal(releases)) | ||
| }) | ||
hongkailiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to verify if the
Qualifiersstill work for BOTH cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For e2e-agnostic-ovn: It contains the non-serial test cases:
The serial job failed at
pre. let us try again./test e2e-agnostic-ovn-techpreview-serial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e-agnostic-ovn-techpreview-serial has the only serial test cases:
It failed on other cases which seems irrelevant to this pull.
/hold cancel
/retest-required