Skip to content

Commit

Permalink
deflake tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nvanbenschoten committed Dec 20, 2023
1 parent e2d4d14 commit ca1f198
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5021,7 +5021,7 @@ func TestChangefeedErrors(t *testing.T) {
)

sqlDB.ExpectErrWithTimeout(
t, `cannot specify timestamp in the future`,
t, `request timestamp .* too far in future`,
`EXPERIMENTAL CHANGEFEED FOR foo WITH cursor=$1`, timeutil.Now().Add(time.Hour),
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo
----
2796048770313977431
4296154144683375258
9 changes: 7 additions & 2 deletions pkg/sql/as_of_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ func TestAsOfTime(t *testing.T) {
t.Fatal(err)
}

// Future queries shouldn't work.
if err := db.QueryRow("SELECT a FROM d.t AS OF SYSTEM TIME '2200-01-01'").Scan(&i); !testutils.IsError(err, "pq: AS OF SYSTEM TIME: cannot specify timestamp in the future") {
// Future queries shouldn't work if too far in the future.
if err := db.QueryRow("SELECT a FROM d.t AS OF SYSTEM TIME '+10h'").Scan(&i); !testutils.IsError(err, "pq: request timestamp .* too far in future") {
t.Fatal(err)
}

// Future queries work if only slightly in the future.
if err := db.QueryRow("SELECT a FROM d.t AS OF SYSTEM TIME '+10ms'").Scan(&i); err != nil {
t.Fatal(err)
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2049,11 +2049,6 @@ func (p *planner) EvalAsOfTimestamp(
if err != nil {
return eval.AsOfSystemTime{}, err
}
ts := asOf.Timestamp
if now := p.execCfg.Clock.Now(); now.Less(ts) {
return eval.AsOfSystemTime{}, errors.Errorf(
"AS OF SYSTEM TIME: cannot specify timestamp in the future (%s > %s)", ts, now)
}
return asOf, nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/sql/tests/rsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ var ignoredErrorPatterns = []string{
"index .* in the middle of being added",
"could not mark job .* as succeeded",
"failed to read backup descriptor",
"AS OF SYSTEM TIME: cannot specify timestamp in the future",
"AS OF SYSTEM TIME: timestamp before 1970-01-01T00:00:00Z is invalid",
"BACKUP for requested time needs option 'revision_history'",
"RESTORE timestamp: supplied backups do not cover requested time",
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/sqlutils/sql_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (sr *SQLRunner) ExpectErrSucceedsSoon(
})
}

// ExpectErrWithTimeout wraps ExpectErr with a timeout..
// ExpectErrWithTimeout wraps ExpectErr with a timeout.
func (sr *SQLRunner) ExpectErrWithTimeout(
t Fataler, errRE string, query string, args ...interface{},
) {
Expand Down

0 comments on commit ca1f198

Please sign in to comment.