Skip to content

Commit c4908ec

Browse files
DarrylWongsrosenberg
authored andcommitted
mixedversion: fix skip upgrade minSupportedVersion edge case
This change adds a check before skipping upgrades that doing so will still generate at least one upgrade that can allow user hooks to run. This happens if the minimum supported version is one skippable version behind the current version.
1 parent b699f1b commit c4908ec

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

pkg/cmd/roachtest/roachtestutil/mixedversion/mixedversion.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,20 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
10691069
return []*clusterupgrade.Version{pred}, nil
10701070
}
10711071

1072+
// If the predecessor same series as the minimum supported version,
1073+
// we need to check that it isn't the only possible upgrade where
1074+
// user steps can run. If it is, don't allow a skip upgrade or else
1075+
// we will generate a plan with zero upgrades that are able to run user hooks.
1076+
if pred.Series() == t.options.minimumSupportedVersion.Series() {
1077+
maxTestUpgrades, err := release.MajorReleasesBetween(&t.options.minimumSupportedVersion.Version, &currentVersion.Version)
1078+
if err != nil {
1079+
return nil, err
1080+
}
1081+
if maxTestUpgrades == 1 {
1082+
return []*clusterupgrade.Version{pred}, nil
1083+
}
1084+
}
1085+
10721086
predPred, err := t.options.predecessorFunc(t.prng, pred, t.options.minimumSupportedVersion, t.options.minimumBootstrapVersion)
10731087
if err != nil {
10741088
return nil, err
@@ -1594,8 +1608,9 @@ func assertValidTest(test *Test, fatalFunc func(...interface{})) {
15941608

15951609
currentVersion := clusterupgrade.CurrentVersion()
15961610
msv := test.options.minimumSupportedVersion
1597-
// The minimum supported version should be strictly less than the current version
1598-
validVersion := currentVersion.AtLeast(msv) && !currentVersion.Equal(msv)
1611+
// The current version should be at least one release series newer from
1612+
// the minimum supported version.
1613+
validVersion := currentVersion.CompareSeries(msv.Version) == 1
15991614

16001615
if !validVersion {
16011616
fail(

0 commit comments

Comments
 (0)