Skip to content

Commit

Permalink
Try to deflake unit test when code coverage is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed May 14, 2024
1 parent 0c84ec1 commit e65f861
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions go/vt/vtctl/workflow/utils_test.go
Expand Up @@ -63,7 +63,7 @@ func TestConcurrentKeyspaceRoutingRulesUpdates(t *testing.T) {

func testConcurrentKeyspaceRoutingRulesUpdates(t *testing.T, ctx context.Context, ts *topo.Server) {
concurrency := 100
duration := 3 * time.Second
duration := 10 * time.Second

var wg sync.WaitGroup
wg.Add(concurrency)
Expand Down Expand Up @@ -130,18 +130,14 @@ func startEtcd(t *testing.T) string {
"-initial-cluster", initialCluster,
"-data-dir", dataDir)
err := cmd.Start()
if err != nil {
t.Fatalf("failed to start etcd: %v", err)
}
require.NoError(t, err, "failed to start etcd")

// Create a client to connect to the created etcd.
cli, err := clientv3.New(clientv3.Config{
Endpoints: []string{clientAddr},
DialTimeout: 5 * time.Second,
})
if err != nil {
t.Fatalf("newCellClient(%v) failed: %v", clientAddr, err)
}
require.NoError(t, err, "newCellClient(%v) failed", clientAddr)
defer cli.Close()

// Wait until we can list "/", or timeout.
Expand All @@ -153,7 +149,7 @@ func startEtcd(t *testing.T) string {
break
}
if time.Since(start) > 10*time.Second {
t.Fatalf("Failed to start etcd daemon in time")
require.FailNow(t, "Failed to start etcd daemon in time")
}
time.Sleep(10 * time.Millisecond)
}
Expand Down

0 comments on commit e65f861

Please sign in to comment.