-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
transfer_manager/go/tests/e2e/ch2ch/multi_db/check_db_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package snapshot | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
|
||
"github.com/doublecloud/transfer/library/go/core/metrics/solomon" | ||
"github.com/doublecloud/transfer/transfer_manager/go/pkg/abstract" | ||
"github.com/doublecloud/transfer/transfer_manager/go/pkg/abstract/coordinator" | ||
chrecipe "github.com/doublecloud/transfer/transfer_manager/go/pkg/providers/clickhouse/recipe" | ||
"github.com/doublecloud/transfer/transfer_manager/go/pkg/worker/tasks" | ||
"github.com/doublecloud/transfer/transfer_manager/go/tests/helpers" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var ( | ||
TransferType = abstract.TransferTypeSnapshotOnly | ||
Source = *chrecipe.MustSource(chrecipe.WithInitFile("dump/src.sql"), chrecipe.WithDatabase("*")) | ||
Target = *chrecipe.MustTarget(chrecipe.WithInitFile("dump/dst.sql"), chrecipe.WithDatabase(""), chrecipe.WithPrefix("DB0_")) | ||
) | ||
|
||
func init() { | ||
_ = os.Setenv("YC", "1") // to not go to vanga | ||
helpers.InitSrcDst(helpers.TransferID, &Source, &Target, TransferType) // to WithDefaults() & FillDependentFields(): IsHomo, helpers.TransferID, IsUpdateable | ||
} | ||
|
||
func TestSnapshot(t *testing.T) { | ||
defer func() { | ||
require.NoError(t, helpers.CheckConnections( | ||
helpers.LabeledPort{Label: "CH source", Port: Source.NativePort}, | ||
helpers.LabeledPort{Label: "CH target", Port: Target.NativePort}, | ||
)) | ||
}() | ||
|
||
transfer := helpers.MakeTransfer("fake", &Source, &Target, abstract.TransferTypeSnapshotOnly) | ||
require.NoError(t, tasks.ActivateDelivery(context.Background(), nil, coordinator.NewFakeClient(), *transfer, solomon.NewRegistry(solomon.NewRegistryOpts()))) | ||
Target.Database = "*" // to force read all db-s | ||
require.NoError(t, helpers.CompareStorages(t, Source, Target, helpers.NewCompareStorageParams())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE DATABASE IF NOT EXISTS db1; | ||
CREATE DATABASE IF NOT EXISTS db2; | ||
CREATE DATABASE IF NOT EXISTS db3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
CREATE DATABASE IF NOT EXISTS db1; | ||
|
||
CREATE TABLE db1.long_line | ||
( | ||
`id` UInt64, | ||
`value` String | ||
) | ||
ENGINE = MergeTree() | ||
ORDER BY (id) | ||
SETTINGS index_granularity = 8192; | ||
|
||
INSERT INTO db1.long_line | ||
(`id`, `value`) | ||
VALUES | ||
(1, repeat('a', 5000)) | ||
; | ||
|
||
CREATE DATABASE IF NOT EXISTS db2; | ||
|
||
CREATE TABLE db2.long_line | ||
( | ||
`id` UInt64, | ||
`value` String | ||
) | ||
ENGINE = MergeTree() | ||
ORDER BY (id) | ||
SETTINGS index_granularity = 8192; | ||
|
||
INSERT INTO db1.long_line | ||
(`id`, `value`) | ||
VALUES | ||
(1, repeat('b', 5000)) | ||
; | ||
|
||
|
||
CREATE DATABASE IF NOT EXISTS db3; | ||
|
||
CREATE TABLE db3.long_line | ||
( | ||
`id` UInt64, | ||
`value` String | ||
) | ||
ENGINE = MergeTree() | ||
ORDER BY (id) | ||
SETTINGS index_granularity = 8192; | ||
|
||
INSERT INTO db1.long_line | ||
(`id`, `value`) | ||
VALUES | ||
(1, repeat('c', 5000)) | ||
; |