diff options
| author | chrislusf <chris.lu@gmail.com> | 2025-12-10 23:40:48 -0800 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2025-12-10 23:40:48 -0800 |
| commit | 7e2d4c24de33c36fba0836312c42019014084d63 (patch) | |
| tree | 9a523171118319ccb3c89db512be3d92b4d21dc2 | |
| parent | 202872d88d743c5626ed95301743205eaabfdd0a (diff) | |
| download | seaweedfs-origin/ec-disk-type-support.tar.xz seaweedfs-origin/ec-disk-type-support.zip | |
test: fix master client timeout causing test hangsorigin/ec-disk-type-support
Use the main test context for KeepConnectedToMaster instead of creating
a separate 60s context. The tests have 180s outer timeouts but the master
client was disconnecting after 60s, causing subsequent commands to hang
waiting for reconnection.
| -rw-r--r-- | test/erasure_coding/ec_integration_test.go | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/test/erasure_coding/ec_integration_test.go b/test/erasure_coding/ec_integration_test.go index bb0983f06..ac85bb08a 100644 --- a/test/erasure_coding/ec_integration_test.go +++ b/test/erasure_coding/ec_integration_test.go @@ -753,11 +753,9 @@ func TestDiskAwareECRebalancing(t *testing.T) { } commandEnv := shell.NewCommandEnv(options) - // Connect to master with longer timeout - ctx2, cancel2 := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel2() - go commandEnv.MasterClient.KeepConnectedToMaster(ctx2) - commandEnv.MasterClient.WaitUntilConnected(ctx2) + // Connect to master - use the main test context to avoid early disconnection + go commandEnv.MasterClient.KeepConnectedToMaster(ctx) + commandEnv.MasterClient.WaitUntilConnected(ctx) // Wait for master client to fully sync time.Sleep(5 * time.Second) @@ -1194,11 +1192,9 @@ func TestECDiskTypeSupport(t *testing.T) { } commandEnv := shell.NewCommandEnv(options) - // Connect to master with longer timeout - ctx2, cancel2 := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel2() - go commandEnv.MasterClient.KeepConnectedToMaster(ctx2) - commandEnv.MasterClient.WaitUntilConnected(ctx2) + // Connect to master - use the main test context to avoid early disconnection + go commandEnv.MasterClient.KeepConnectedToMaster(ctx) + commandEnv.MasterClient.WaitUntilConnected(ctx) // Wait for master client to fully sync time.Sleep(5 * time.Second) @@ -1569,11 +1565,9 @@ func TestECDiskTypeMixedCluster(t *testing.T) { } commandEnv := shell.NewCommandEnv(options) - // Connect to master with longer timeout - ctx2, cancel2 := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel2() - go commandEnv.MasterClient.KeepConnectedToMaster(ctx2) - commandEnv.MasterClient.WaitUntilConnected(ctx2) + // Connect to master - use the main test context to avoid early disconnection + go commandEnv.MasterClient.KeepConnectedToMaster(ctx) + commandEnv.MasterClient.WaitUntilConnected(ctx) // Wait for master client to fully sync time.Sleep(5 * time.Second) @@ -1770,10 +1764,9 @@ func TestEvacuationFallbackBehavior(t *testing.T) { } commandEnv := shell.NewCommandEnv(options) - ctx2, cancel2 := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel2() - go commandEnv.MasterClient.KeepConnectedToMaster(ctx2) - commandEnv.MasterClient.WaitUntilConnected(ctx2) + // Connect to master - use the main test context to avoid early disconnection + go commandEnv.MasterClient.KeepConnectedToMaster(ctx) + commandEnv.MasterClient.WaitUntilConnected(ctx) time.Sleep(5 * time.Second) @@ -1875,10 +1868,9 @@ func TestCrossRackECPlacement(t *testing.T) { } commandEnv := shell.NewCommandEnv(options) - ctx2, cancel2 := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel2() - go commandEnv.MasterClient.KeepConnectedToMaster(ctx2) - commandEnv.MasterClient.WaitUntilConnected(ctx2) + // Connect to master - use the main test context to avoid early disconnection + go commandEnv.MasterClient.KeepConnectedToMaster(ctx) + commandEnv.MasterClient.WaitUntilConnected(ctx) time.Sleep(5 * time.Second) |
