Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roachtests: re-enable election-after-restart and kv/gracefuldraining/nodes=3 #53689

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion pkg/cmd/roachtest/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ import (
"context"
"time"

"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
)

func registerElectionAfterRestart(r *testRegistry) {
r.Add(testSpec{
Name: "election-after-restart",
Owner: OwnerKV,
Skip: "https://github.com/cockroachdb/cockroach/issues/35047",
Cluster: makeClusterSpec(3),
Run: func(ctx context.Context, t *test, c *cluster) {
skip.UnderRace(t, "race builds make this test exceed its timeout")

t.Status("starting up")
c.Put(ctx, cockroach, "./cockroach")
c.Start(ctx, t)
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/roachtest/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/ts/tspb"
"github.com/cockroachdb/cockroach/pkg/util/httputil"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
Expand Down Expand Up @@ -349,11 +350,12 @@ func registerKVQuiescenceDead(r *testRegistry) {

func registerKVGracefulDraining(r *testRegistry) {
r.Add(testSpec{
Skip: "https://github.com/cockroachdb/cockroach/issues/33501",
Name: "kv/gracefuldraining/nodes=3",
Owner: OwnerKV,
Cluster: makeClusterSpec(4),
Run: func(ctx context.Context, t *test, c *cluster) {
skip.UnderRace(t, "race builds make this test exceed its timeout")

nodes := c.spec.NodeCount - 1
c.Put(ctx, cockroach, "./cockroach", c.Range(1, nodes))
c.Put(ctx, workload, "./workload", c.Node(nodes+1))
Expand Down
24 changes: 19 additions & 5 deletions pkg/cmd/roachtest/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"strings"
"time"

"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/cockroach/pkg/util/version"
Expand Down Expand Up @@ -232,11 +233,24 @@ func (t *test) WorkerProgress(frac float64) {
t.progress(goid.Get(), frac)
}

// Skip records msg into t.spec.Skip and calls panic(errTestFatal) - thus
// interrupting the running of the test.
func (t *test) Skip(msg string, details string) {
t.spec.Skip = msg
t.spec.SkipDetails = details
var _ skip.SkippableTest = (*test)(nil)

// Skip skips the test. The first argument if any is the main message.
// The remaining argument, if any, form the details.
// This implements the skip.SkippableTest interface.
func (t *test) Skip(args ...interface{}) {
if len(args) > 0 {
t.spec.Skip = fmt.Sprint(args[0])
args = args[1:]
}
t.spec.SkipDetails = fmt.Sprint(args...)
panic(errTestFatal)
}

// Skipf skips the test. The formatted message becomes the skip reason.
// This implements the skip.SkippableTest interface.
func (t *test) Skipf(format string, args ...interface{}) {
t.spec.Skip = fmt.Sprintf(format, args...)
panic(errTestFatal)
}

Expand Down
20 changes: 13 additions & 7 deletions pkg/testutils/skip/skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ import (
"github.com/cockroachdb/cockroach/pkg/util"
)

// SkippableTest is a testing.TB with Skip methods.
type SkippableTest interface {
Skip(...interface{})
Skipf(string, ...interface{})
}

// WithIssue skips this test, logging the given issue ID as the reason.
func WithIssue(t testing.TB, githubIssueID int, args ...interface{}) {
func WithIssue(t SkippableTest, githubIssueID int, args ...interface{}) {
t.Skip(append([]interface{}{
fmt.Sprintf("https://github.com/cockroachdb/cockroach/issue/%d", githubIssueID)},
args...))
Expand All @@ -27,39 +33,39 @@ func WithIssue(t testing.TB, githubIssueID int, args ...interface{}) {
// IgnoreLint skips this test, explicitly marking it as not a test that
// should be tracked as a "skipped test" by external tools. You should use this
// if, for example, your test should only be run in Race mode.
func IgnoreLint(t testing.TB, args ...interface{}) {
func IgnoreLint(t SkippableTest, args ...interface{}) {
t.Skip(args...)
}

// IgnoreLintf is like IgnoreLint, and it also takes a format string.
func IgnoreLintf(t testing.TB, format string, args ...interface{}) {
func IgnoreLintf(t SkippableTest, format string, args ...interface{}) {
t.Skipf(format, args...)
}

// UnderRace skips this test if the race detector is enabled.
func UnderRace(t testing.TB, args ...interface{}) {
func UnderRace(t SkippableTest, args ...interface{}) {
if util.RaceEnabled {
t.Skip(append([]interface{}{"disabled under race"}, args...))
}
}

// UnderShort skips this test if the -short flag is specified.
func UnderShort(t testing.TB, args ...interface{}) {
func UnderShort(t SkippableTest, args ...interface{}) {
if testing.Short() {
t.Skip(append([]interface{}{"disabled under -short"}, args...))
}
}

// UnderStress skips this test when running under stress.
func UnderStress(t testing.TB, args ...interface{}) {
func UnderStress(t SkippableTest, args ...interface{}) {
if NightlyStress() {
t.Skip(append([]interface{}{"disabled under stress"}, args...))
}
}

// UnderStressRace skips this test during stressrace runs, which are tests
// run under stress with the -race flag.
func UnderStressRace(t testing.TB, args ...interface{}) {
func UnderStressRace(t SkippableTest, args ...interface{}) {
if NightlyStress() && util.RaceEnabled {
t.Skip(append([]interface{}{"disabled under stressrace"}, args...))
}
Expand Down