Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions test/e2e/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,18 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam

// this is very long. We should update the clusteroperator junit to give us a duration.
maximumDuration := 150 * time.Minute
// if upgrades take longer than this, then we will have a junit marker indicating failure.
durationToSoftFailure := 75 * time.Minute
baseDurationToSoftFailure := 75 * time.Minute
durationToSoftFailure := baseDurationToSoftFailure

network, err := c.ConfigV1().Networks().Get(context.Background(), "cluster", metav1.GetOptions{})
framework.ExpectNoError(err)
if network.Status.NetworkType == "OVNKubernetes" {
// deploying with OVN is expected to take longer. on average, ~15m longer
// some extra context to this increase which links to a jira showing which operators take longer:
// compared to OpenShiftSDN:
// https://bugzilla.redhat.com/show_bug.cgi?id=1942164
durationToSoftFailure = baseDurationToSoftFailure + (15 * time.Minute)
}

framework.Logf("Starting upgrade to version=%s image=%s", version.Version.String(), version.NodeImage)

Expand All @@ -271,9 +281,11 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam
case upgradeAbortAtRandom:
abortAt = int(rand.Int31n(100) + 1)
maximumDuration *= 2
durationToSoftFailure *= 2
framework.Logf("Upgrade will be aborted and the cluster will roll back to the current version after %d%% of operators have upgraded (picked randomly)", abortAt)
default:
maximumDuration *= 2
durationToSoftFailure *= 2
framework.Logf("Upgrade will be aborted and the cluster will roll back to the current version after %d%% of operators have upgraded", upgradeAbortAt)
}

Expand Down Expand Up @@ -346,6 +358,7 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam
func() error {
framework.Logf("Cluster version operator acknowledged upgrade request")
aborted := false
action := "upgrade"
var lastMessage string
upgradeStarted := time.Now()

Expand Down Expand Up @@ -379,28 +392,30 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam
return false, err
}
aborted = true
action = "aborted upgrade"
return false, nil
}

return monitor.Reached(cv, desired)

}); err != nil {
if lastMessage != "" {
return fmt.Errorf("Cluster did not complete upgrade: %v: %s", err, lastMessage)
return fmt.Errorf("Cluster did not complete %s: %v: %s", action, err, lastMessage)
}
return fmt.Errorf("Cluster did not complete upgrade: %v", err)
return fmt.Errorf("Cluster did not complete %s: %v", action, err)
}

framework.Logf("Completed upgrade to %s", versionString(desired))
framework.Logf("Completed %s to %s", action, versionString(desired))

// record whether the cluster was fast or slow upgrading. Don't fail the test, we still want signal on the actual tests themselves.
upgradeEnded := time.Now()
upgradeDuration := upgradeEnded.Sub(upgradeStarted)
testCaseName := fmt.Sprintf("[sig-cluster-lifecycle] cluster upgrade should complete in %0.2f minutes", durationToSoftFailure.Minutes())
failure := ""
if upgradeDuration > durationToSoftFailure {
disruption.RecordJUnitResult(f, "[sig-cluster-lifecycle] cluster upgrade should be fast", upgradeDuration, fmt.Sprintf("Upgrade took too long: %v", upgradeDuration.Minutes()))
} else {
disruption.RecordJUnitResult(f, "[sig-cluster-lifecycle] cluster upgrade should be fast", upgradeDuration, "")
failure = fmt.Sprintf("%s to %s took too long: %0.2f minutes", action, versionString(desired), upgradeDuration.Minutes())
}
disruption.RecordJUnitResult(f, testCaseName, upgradeDuration, failure)

return nil
},
Expand Down