diff options
Diffstat (limited to 'test/e2e-go/features/partitionRecovery/partitionRecovery_test.go')
-rw-r--r-- | test/e2e-go/features/partitionRecovery/partitionRecovery_test.go | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/e2e-go/features/partitionRecovery/partitionRecovery_test.go b/test/e2e-go/features/partitionRecovery/partitionRecovery_test.go index 7e7823093..d686ed798 100644 --- a/test/e2e-go/features/partitionRecovery/partitionRecovery_test.go +++ b/test/e2e-go/features/partitionRecovery/partitionRecovery_test.go @@ -32,6 +32,7 @@ const inducePartitionTime = 6 * time.Second // Try to minimize change of proc func TestBasicPartitionRecovery(t *testing.T) { partitiontest.PartitionTest(t) + defer fixtures.ShutdownSynchronizedTest(t) if testing.Short() { t.Skip() @@ -78,6 +79,7 @@ func TestBasicPartitionRecovery(t *testing.T) { func TestPartitionRecoverySwapStartup(t *testing.T) { partitiontest.PartitionTest(t) + defer fixtures.ShutdownSynchronizedTest(t) if testing.Short() { t.Skip() @@ -100,6 +102,7 @@ func TestPartitionRecoverySwapStartup(t *testing.T) { func TestPartitionRecoveryStaggerRestart(t *testing.T) { partitiontest.PartitionTest(t) + defer fixtures.ShutdownSynchronizedTest(t) if testing.Short() { t.Skip() @@ -135,6 +138,10 @@ func runTestWithStaggeredStopStart(t *testing.T, fixture *fixtures.RestClientFix // Stop Node1 nc1.FullStop() + status, err := fixture.LibGoalClient.Status() + a.NoError(err) + roundAfterStop := status.LastRound + time.Sleep(inducePartitionTime) // Use the fixture to start the node again so it supplies the correct peer addresses @@ -152,10 +159,10 @@ func runTestWithStaggeredStopStart(t *testing.T, fixture *fixtures.RestClientFix a.NoError(err) // Now wait for us to make progress again. - status, err := fixture.LibGoalClient.Status() + status, err = fixture.LibGoalClient.Status() a.NoError(err) - a.Equal(waitForRound, status.LastRound, "We should not have made progress since stopping the first node") + a.Equal(roundAfterStop, status.LastRound, "We should not have made progress since stopping the first node") err = fixture.WaitForRound(status.LastRound+1, partitionRecoveryTime) a.NoError(err) @@ -163,6 +170,7 @@ func runTestWithStaggeredStopStart(t *testing.T, fixture *fixtures.RestClientFix func TestBasicPartitionRecoveryPartOffline(t *testing.T) { partitiontest.PartitionTest(t) + defer fixtures.ShutdownSynchronizedTest(t) if testing.Short() { t.Skip() @@ -193,6 +201,10 @@ func TestBasicPartitionRecoveryPartOffline(t *testing.T) { // Stop Node1 nc1.FullStop() + status, err := fixture.LibGoalClient.Status() + a.NoError(err) + roundAfterStop := status.LastRound + // Stop the 2nd node and give network a chance to stall nc2, err := fixture.GetNodeController("Node2") a.NoError(err) @@ -205,10 +217,10 @@ func TestBasicPartitionRecoveryPartOffline(t *testing.T) { a.NoError(err) // Now wait for us to make progress again. - status, err := fixture.LibGoalClient.Status() + status, err = fixture.LibGoalClient.Status() a.NoError(err) - a.Equal(waitForRound, status.LastRound, "We should not have made progress since stopping the first node") + a.Equal(roundAfterStop, status.LastRound, "We should not have made progress since stopping the first node") err = fixture.WaitForRound(status.LastRound+1, partitionRecoveryTime) a.NoError(err) @@ -216,6 +228,7 @@ func TestBasicPartitionRecoveryPartOffline(t *testing.T) { func TestPartitionHalfOffline(t *testing.T) { partitiontest.PartitionTest(t) + defer fixtures.ShutdownSynchronizedTest(t) if testing.Short() { t.Skip() @@ -253,12 +266,16 @@ func TestPartitionHalfOffline(t *testing.T) { a.NoError(err) nc3.FullStop() + status, err := client.Status() + a.NoError(err) + roundAfterStop := status.LastRound + time.Sleep(inducePartitionTime) // Get main client to monitor - status, err := client.Status() + status, err = client.Status() a.NoError(err) - a.Equal(waitForRound, status.LastRound, "We should not have made progress since stopping the nodes") + a.Equal(roundAfterStop, status.LastRound, "We should not have made progress since stopping the nodes") // Start 40 of 50% of the stake _, err = fixture.StartNode(nc1.GetDataDir()) |