Skip to content

Commit

Permalink
Merge pull request #101056 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-23.1-100922

release-23.1: server: increase timeout for TestClusterVersionUpgrade
  • Loading branch information
rafiss authored Apr 10, 2023
2 parents 416beb7 + 79c9ca1 commit 1fdeb35
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/server/version_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"path/filepath"
"strconv"
"testing"
"time"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/clusterversion"
Expand Down Expand Up @@ -256,16 +257,16 @@ func TestClusterVersionUpgrade(t *testing.T) {
}

// Check the cluster version is bumped to newVersion.
testutils.SucceedsSoon(t, func() error {
testutils.SucceedsWithin(t, func() error {
if version := tc.getVersionFromSelect(0); version != newVersion.String() {
return errors.Errorf("cluster version is still %s, should be %s", version, newVersion)
}
return nil
})
}, 3*time.Minute)
curVersion = tc.getVersionFromSelect(0)
isNoopUpdate := curVersion == newVersion.String()

testutils.SucceedsSoon(t, func() error {
testutils.SucceedsWithin(t, func() error {
for i := 0; i < tc.NumServers(); i++ {
st := tc.Servers[i].ClusterSettings()
v := st.Version.ActiveVersion(ctx)
Expand All @@ -279,14 +280,14 @@ func TestClusterVersionUpgrade(t *testing.T) {
}
}
return nil
})
}, 3*time.Minute)

exp := newVersion.String()

// Read the versions from the table from each node. Note that under the
// hood, everything goes to the lease holder and so it's pretty much
// guaranteed that they all read the same, but it doesn't hurt to check.
testutils.SucceedsSoon(t, func() error {
testutils.SucceedsWithin(t, func() error {
for i := 0; i < tc.NumServers(); i++ {
if version := tc.getVersionFromSelect(i); version != exp {
return errors.Errorf("%d: incorrect version %q (wanted %s)", i, version, exp)
Expand All @@ -296,13 +297,13 @@ func TestClusterVersionUpgrade(t *testing.T) {
}
}
return nil
})
}, 3*time.Minute)

// Now check the Settings.Version variable. That is the tricky one for which
// we "hold back" a gossip update until we've written to the engines. We may
// have to wait a bit until we see the new version here, even though it's
// already in the table.
testutils.SucceedsSoon(t, func() error {
testutils.SucceedsWithin(t, func() error {
for i := 0; i < tc.NumServers(); i++ {
vers := tc.Servers[i].ClusterSettings().Version.ActiveVersion(ctx)
if v := vers.String(); v == curVersion {
Expand All @@ -315,7 +316,7 @@ func TestClusterVersionUpgrade(t *testing.T) {
}
}
return nil
})
}, 3*time.Minute)

// Since the wrapped version setting exposes the new versions, it must
// definitely be present on all stores on the first try.
Expand Down

0 comments on commit 1fdeb35

Please sign in to comment.