From 714858299af122109aff45c4970278b2b6c8f27c Mon Sep 17 00:00:00 2001 From: Jan Grodowski Date: Tue, 10 Dec 2024 13:49:35 +0100 Subject: [PATCH] Increase data volume for TestSelectiveCopyDataWithInsertLoadOnAllTenants, potential source of flakiness Hypothesis: MixedActionDataWriter doesn't has a chance to start (goroutine), give it more time. Ideal solution would be to introduce some form of synchronization, but let's try this first. Partially reverts a speedup change from https://github.com/Shopify/ghostferry/commit/a288a28f20182f989be115e48acd9dc6b922ec47 --- sharding/test/trivial_integration_test.go | 8 ++++---- testhelpers/data_writer.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sharding/test/trivial_integration_test.go b/sharding/test/trivial_integration_test.go index 4c27a23b..907753b9 100644 --- a/sharding/test/trivial_integration_test.go +++ b/sharding/test/trivial_integration_test.go @@ -12,7 +12,7 @@ import ( ) func setupSingleTableDatabase(f *testhelpers.TestFerry, sourceDB, targetDB *sql.DB) { - testhelpers.SeedInitialData(sourceDB, "gftest", "table1", 100) + testhelpers.SeedInitialData(sourceDB, "gftest", "table1", 1000) testhelpers.SeedInitialData(targetDB, "gftest", "table1", 0) testhelpers.AddTenantID(sourceDB, "gftest", "table1", 3) @@ -51,7 +51,7 @@ func TestSelectiveCopyDataWithoutAnyWritesToSource(t *testing.T) { assert.Equal(t, 0, count) rows := testcase.AssertQueriesHaveEqualResult("SELECT * FROM gftest.table1 WHERE tenant_id = 2") - assert.Equal(t, 33, len(rows)) + assert.Equal(t, 333, len(rows)) } func TestSelectiveCopyDataWithInsertLoadOnOtherTenants(t *testing.T) { @@ -79,7 +79,7 @@ func TestSelectiveCopyDataWithInsertLoadOnOtherTenants(t *testing.T) { assert.Equal(t, 0, count) rows := testcase.AssertQueriesHaveEqualResult("SELECT * FROM gftest.table1 WHERE tenant_id = 2") - assert.Equal(t, 33, len(rows)) + assert.Equal(t, 333, len(rows)) } func TestSelectiveCopyDataWithInsertLoadOnAllTenants(t *testing.T) { @@ -107,7 +107,7 @@ func TestSelectiveCopyDataWithInsertLoadOnAllTenants(t *testing.T) { assert.Equal(t, 0, count) rows := testcase.AssertQueriesHaveEqualResult("SELECT * FROM gftest.table1 WHERE tenant_id = 2") - assert.True(t, len(rows) > 33) + assert.True(t, len(rows) > 333) } type ChangeShardingKeyDataWriter struct { diff --git a/testhelpers/data_writer.go b/testhelpers/data_writer.go index 700e3f39..101fddb2 100644 --- a/testhelpers/data_writer.go +++ b/testhelpers/data_writer.go @@ -5,9 +5,8 @@ import ( "math/rand" "sync" - sql "github.com/Shopify/ghostferry/sqlwrapper" - sq "github.com/Masterminds/squirrel" + sql "github.com/Shopify/ghostferry/sqlwrapper" ) var dataletters = []rune("abcdefghijklmnopqrstuvwxyz")