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

sql: de-flake TestDistSQLFlowsVirtualTables #75638

Merged
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
30 changes: 24 additions & 6 deletions pkg/sql/crdb_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/tests"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/ctxgroup"
Expand Down Expand Up @@ -517,7 +516,6 @@ UPDATE system.namespace SET id = 12345 WHERE id = %d;

func TestDistSQLFlowsVirtualTables(t *testing.T) {
defer leaktest.AfterTest(t)()
skip.UnderRaceWithIssue(t, 75208, "flaky test under race")
defer log.Scope(t).Close(t)

const numNodes = 3
Expand Down Expand Up @@ -686,8 +684,18 @@ func TestDistSQLFlowsVirtualTables(t *testing.T) {
if maxRunningFlows == 1 {
expRunning, expQueued = expQueued, expRunning
}
if getNum(db, clusterScope, runningStatus) != expRunning || getNum(db, clusterScope, queuedStatus) != expQueued {
t.Fatalf("unexpected output from cluster_distsql_flows on node %d", nodeID+1)
gotRunning, gotQueued := getNum(db, clusterScope, runningStatus), getNum(db, clusterScope, queuedStatus)
if gotRunning != expRunning {
t.Fatalf("unexpected output from cluster_distsql_flows on node %d (running=%d)", nodeID+1, gotRunning)
}
if maxRunningFlows == 1 {
if gotQueued != expQueued {
t.Fatalf("unexpected output from cluster_distsql_flows on node %d (queued=%d)", nodeID+1, gotQueued)
}
} else {
if gotQueued > expQueued { // it's possible for the query to have already errored out
t.Fatalf("unexpected output from cluster_distsql_flows on node %d (queued=%d)", nodeID+1, gotQueued)
}
}

// Check node level table.
Expand All @@ -700,8 +708,18 @@ func TestDistSQLFlowsVirtualTables(t *testing.T) {
if maxRunningFlows == 1 {
expRunning, expQueued = expQueued, expRunning
}
if getNum(db, nodeScope, runningStatus) != expRunning || getNum(db, nodeScope, queuedStatus) != expQueued {
t.Fatalf("unexpected output from node_distsql_flows on node %d", nodeID+1)
gotRunning, gotQueued = getNum(db, nodeScope, runningStatus), getNum(db, nodeScope, queuedStatus)
if gotRunning != expRunning {
t.Fatalf("unexpected output from node_distsql_flows on node %d (running=%d)", nodeID+1, gotRunning)
}
if maxRunningFlows == 1 {
if gotQueued != expQueued {
t.Fatalf("unexpected output from node_distsql_flows on node %d (queued=%d)", nodeID+1, gotQueued)
}
} else {
if gotQueued > expQueued { // it's possible for the query to have already errored out
t.Fatalf("unexpected output from node_distsql_flows on node %d (queued=%d)", nodeID+1, gotQueued)
}
}
}
}
Expand Down