Skip to content

Commit f397c13

Browse files
committed
schemachanger: Unskip some backup tests
Release note: None
1 parent 78783e8 commit f397c13

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

pkg/sql/schemachanger/sctest/backup.go

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,13 @@ import (
3535
"github.com/stretchr/testify/require"
3636
)
3737

38-
// TODO (xiang): Fix and unskip those flaky backup tests.
39-
func skipFlakyBackupTests(t *testing.T, path string) {
40-
if strings.Contains(path, "alter_table_multiple_commands") ||
41-
strings.Contains(path, "alter_table_alter_primary_key_drop_rowid") ||
42-
strings.Contains(path, "drop_column_basic") {
43-
skip.WithIssue(t, 108221, "skipping flaky tests")
44-
}
45-
}
46-
4738
// BackupSuccess tests that the schema changer can handle being backed up
4839
// any time during a successful schema change.
4940
func BackupSuccess(t *testing.T, path string, factory TestServerFactory) {
5041
// These tests are expensive.
5142
skip.UnderStress(t)
5243
skip.UnderRace(t)
5344

54-
skipFlakyBackupTests(t, path)
55-
5645
cumulativeTestForEachPostCommitStage(t, path, factory, func(t *testing.T, cs CumulativeTestCaseSpec) {
5746
backupSuccess(t, factory, cs)
5847
})
@@ -68,8 +57,6 @@ func BackupRollbacks(t *testing.T, path string, factory TestServerFactory) {
6857
// and at least as expensive to run.
6958
skip.UnderShort(t)
7059

71-
skipFlakyBackupTests(t, path)
72-
7360
cumulativeTestForEachPostCommitStage(t, path, factory, func(t *testing.T, cs CumulativeTestCaseSpec) {
7461
backupRollbacks(t, factory, cs)
7562
})
@@ -85,8 +72,6 @@ func BackupSuccessMixedVersion(t *testing.T, path string, factory TestServerFact
8572
// and at least as expensive to run.
8673
skip.UnderShort(t)
8774

88-
skipFlakyBackupTests(t, path)
89-
9075
factory = factory.WithMixedVersion()
9176
cumulativeTestForEachPostCommitStage(t, path, factory, func(t *testing.T, cs CumulativeTestCaseSpec) {
9277
backupSuccess(t, factory, cs)
@@ -103,8 +88,6 @@ func BackupRollbacksMixedVersion(t *testing.T, path string, factory TestServerFa
10388
// and at least as expensive to run.
10489
skip.UnderShort(t)
10590

106-
skipFlakyBackupTests(t, path)
107-
10891
factory = factory.WithMixedVersion()
10992
cumulativeTestForEachPostCommitStage(t, path, factory, func(t *testing.T, cs CumulativeTestCaseSpec) {
11093
backupRollbacks(t, factory, cs)
@@ -117,21 +100,17 @@ var runAllBackups = flag.Bool(
117100
"if true, run all backups instead of a random subset",
118101
)
119102

120-
// If the number of stages in the same phase exceeds skipThreshold, we enable
121-
// skipping such that the backup test for each stage is skipped with probability
122-
// skipRate.
123-
// Set runAllBackups to true to disable skipping altogether.
124-
const skipThreshold = 10
125103
const skipRate = .5
126104

127-
func maybeRandomlySkip(t *testing.T, stageCountInPhase int) {
128-
if !*runAllBackups && stageCountInPhase > skipThreshold && rand.Float64() < skipRate {
105+
func maybeRandomlySkip(t *testing.T) {
106+
if !*runAllBackups && rand.Float64() < skipRate {
129107
skip.IgnoreLint(t, "skipping due to randomness")
130108
}
131109
}
132110

133111
func backupSuccess(t *testing.T, factory TestServerFactory, cs CumulativeTestCaseSpec) {
134-
maybeRandomlySkip(t, cs.StagesCount)
112+
maybeRandomlySkip(t)
113+
t.Parallel() // SAFE FOR TESTING (this comment is for the linter)
135114
ctx := context.Background()
136115
url := fmt.Sprintf("userfile://backups.public.userfiles_$user/data_%s_%d",
137116
cs.Phase, cs.StageOrdinal)
@@ -240,7 +219,8 @@ func backupRollbacks(t *testing.T, factory TestServerFactory, cs CumulativeTestC
240219
if cs.Phase != scop.PostCommitPhase {
241220
return
242221
}
243-
maybeRandomlySkip(t, cs.StagesCount)
222+
maybeRandomlySkip(t)
223+
t.Parallel() // SAFE FOR TESTING (this comment is for the linter)
244224
ctx := context.Background()
245225
var urls atomic.Value
246226
var dbForBackup atomic.Pointer[gosql.DB]

pkg/sql/schemachanger/sctest/framework.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,6 @@ func cumulativeTestForEachPostCommitStage(
713713
var hasFailed bool
714714
for _, tc := range testCases {
715715
fn := func(t *testing.T) {
716-
t.Parallel() // SAFE FOR TESTING
717716
tf(t, tc)
718717
}
719718
if hasFailed {

0 commit comments

Comments
 (0)