Skip to content

Commit a95e17f

Browse files
Merge pull request #28402 from wking/complete-update-for-abort-at-100
NO-JIRA: test/e2e/upgrade/monitor: --abort-at=100 requires a complete update
2 parents b7a93b9 + e64f453 commit a95e17f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

pkg/cmd/openshift-tests/run-upgrade/command.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func NewRunUpgradeCommand(streams genericclioptions.IOStreams) *cobra.Command {
2929
Supported options:
3030
3131
* abort-at=NUMBER - Set to a number between 0 and 100 to control the percent of operators
32-
at which to stop the current upgrade and roll back to the current version.
32+
at which to stop the current upgrade and roll back to the current version (100 to require a
33+
complete update).
3334
* disrupt-reboot=POLICY - During upgrades, periodically reboot master nodes. If set to 'graceful'
3435
the reboot will allow the node to shut down services in an orderly fashion. If set to 'force' the
3536
machine will terminate immediately without clean shutdown.

test/e2e/upgrade/monitor.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,23 @@ func (m *versionMonitor) ShouldReboot() []string {
107107
return nil
108108
}
109109

110-
func (m *versionMonitor) ShouldUpgradeAbort(abortAt int) bool {
110+
func (m *versionMonitor) ShouldUpgradeAbort(abortAt int, desired configv1.Update) bool {
111111
if abortAt == 0 {
112112
return false
113113
}
114+
115+
if abortAt == 100 {
116+
if m.lastCV == nil {
117+
return false // wait for m.Check() to populate a ClusterVersion
118+
}
119+
120+
if len(m.lastCV.Status.History) == 0 {
121+
return false // wait for the cluster-version operator to populate history
122+
}
123+
history := m.lastCV.Status.History[0]
124+
return history.Image == desired.Image && history.State == configv1.CompletedUpdate
125+
}
126+
114127
coList, err := m.client.ConfigV1().ClusterOperators().List(context.Background(), metav1.ListOptions{})
115128
if err != nil {
116129
framework.Logf("Unable to retrieve cluster operators, cannot check completion percentage")

test/e2e/upgrade/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam
544544
return false, err
545545
}
546546

547-
if !aborted && monitor.ShouldUpgradeAbort(abortAt) {
547+
if !aborted && monitor.ShouldUpgradeAbort(abortAt, desired) {
548548
framework.Logf("Instructing the cluster to return to %s / %s", original.Status.Desired.Version, original.Status.Desired.Image)
549549
desired = configv1.Update{
550550
Image: original.Status.Desired.Image,

0 commit comments

Comments
 (0)