Skip to content

Commit

Permalink
Increase data volume for TestSelectiveCopyDataWithInsertLoadOnAllTena…
Browse files Browse the repository at this point in the history
…nts, 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 a288a28
  • Loading branch information
grodowski committed Dec 10, 2024
1 parent 837f027 commit 7148582
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions sharding/test/trivial_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions testhelpers/data_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7148582

Please sign in to comment.