From f8e3794bec56a33065c62947af0d634fd5d07f59 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Wed, 2 Aug 2023 16:00:52 -0400 Subject: [PATCH 1/2] add label so break works as intended previously `break` was operating on the `select`, which means there was no functional difference between the two select cases Signed-off-by: Andrew Mason --- .../vrepl_stress/onlineddl_vrepl_mini_stress_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go index 1f1f3b9c5b7..b29c1a6e585 100644 --- a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go +++ b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go @@ -372,6 +372,8 @@ func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName stri ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() rowcount := 0 + +loop: for { queryResult, err := tablet.VttabletProcess.QueryTablet(query, keyspaceName, true) require.Nil(t, err) @@ -383,9 +385,10 @@ func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName stri select { case <-time.After(time.Second): case <-ctx.Done(): - break + break loop } } + assert.Equal(t, expectCount, rowcount) } From 916a823dd65bca03561a2ff5bcb216498d68d890 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Thu, 3 Aug 2023 06:16:38 -0400 Subject: [PATCH 2/2] labeless approach Signed-off-by: Andrew Mason --- .../vrepl_stress/onlineddl_vrepl_mini_stress_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go index b29c1a6e585..107050c2708 100644 --- a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go +++ b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go @@ -373,7 +373,6 @@ func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName stri defer cancel() rowcount := 0 -loop: for { queryResult, err := tablet.VttabletProcess.QueryTablet(query, keyspaceName, true) require.Nil(t, err) @@ -384,9 +383,12 @@ loop: select { case <-time.After(time.Second): + continue // Keep looping case <-ctx.Done(): - break loop + // Break below to the assertion } + + break } assert.Equal(t, expectCount, rowcount)