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

democluster: fix a flake in TestTransientClusterMultitenant #106679

Merged
merged 1 commit into from
Jul 12, 2023
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
17 changes: 9 additions & 8 deletions pkg/cli/democluster/demo_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ func TestTransientClusterMultitenant(t *testing.T) {

// This test is too slow to complete under the race detector, sometimes.
skip.UnderRace(t)
skip.WithIssue(t, 96162)

defer TestingForceRandomizeDemoPorts()()

Expand Down Expand Up @@ -296,12 +295,13 @@ func TestTransientClusterMultitenant(t *testing.T) {
defer c.Close(ctx)

require.NoError(t, c.generateCerts(ctx, certsDir))
require.NoError(t, c.Start(ctx))

// Also ensure the context gets canceled when the stopper
// terminates above.
ctx, _ = c.stopper.WithCancelOnQuiesce(ctx)

require.NoError(t, c.Start(ctx))
var cancel func()
ctx, cancel = c.stopper.WithCancelOnQuiesce(ctx)
defer cancel()

testutils.RunTrueAndFalse(t, "forSecondaryTenant", func(t *testing.T, forSecondaryTenant bool) {
url, err := c.getNetworkURLForServer(ctx, 0,
Expand All @@ -310,12 +310,13 @@ func TestTransientClusterMultitenant(t *testing.T) {
sqlConnCtx := clisqlclient.Context{}
conn := sqlConnCtx.MakeSQLConn(io.Discard, io.Discard, url.ToPQ().String())
defer func() {
if err := conn.Close(); err != nil {
t.Fatal(err)
}
require.NoError(t, conn.Close())
}()

// Create a table on each tenant to make sure that the tenants are separate.
require.NoError(t, conn.Exec(context.Background(), "CREATE TABLE a (a int PRIMARY KEY)"))
require.NoError(t, conn.Exec(ctx, "CREATE TABLE a (a int PRIMARY KEY)"))

log.Infof(ctx, "test succeeded")
t.Log("test succeeded")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case it shows up during review: this logging helps troubleshoot when looking at the log output.

})
}