Skip to content

Commit d2bdd38

Browse files
authored
Check uuid in pk replication works (#7950)
1 parent b57e4f7 commit d2bdd38

File tree

1 file changed

+12
-7
lines changed
  • ydb/tests/functional/replication

1 file changed

+12
-7
lines changed

ydb/tests/functional/replication/main.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ Y_UNIT_TEST_SUITE(Replication)
4242
auto res = session.ExecuteSchemeQuery(R"(
4343
CREATE TABLE `/local/ProducerUuidValue` (
4444
Key Uint32,
45+
Key2 Uuid,
4546
v01 Uuid,
4647
v02 Uuid NOT NULL,
4748
v03 Double,
48-
PRIMARY KEY (Key)
49+
PRIMARY KEY (Key, Key2)
4950
);
5051
)").GetValueSync();
5152
UNIT_ASSERT_C(res.IsSuccess(), res.GetIssues().ToString());
@@ -57,8 +58,9 @@ Y_UNIT_TEST_SUITE(Replication)
5758
auto s = sessionResult.GetSession();
5859

5960
{
60-
const TString query = "UPSERT INTO ProducerUuidValue (Key,v01,v02,v03) VALUES"
61+
const TString query = "UPSERT INTO ProducerUuidValue (Key,Key2,v01,v02,v03) VALUES"
6162
"(1, "
63+
"CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea00\" as Uuid), "
6264
"CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea01\" as Uuid), "
6365
"UNWRAP(CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea02\" as Uuid)), "
6466
"CAST(\"311111111113.222222223\" as Double) "
@@ -88,6 +90,7 @@ Y_UNIT_TEST_SUITE(Replication)
8890
UNIT_ASSERT_C(sessionResult.IsSuccess(), sessionResult.GetIssues().ToString());
8991

9092
auto s = sessionResult.GetSession();
93+
TUuidValue expectedKey2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea00");
9194
TUuidValue expectedV1("5b99a330-04ef-4f1a-9b64-ba6d5f44ea01");
9295
TUuidValue expectedV2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea02");
9396
double expectedV3 = 311111111113.222222223;
@@ -97,11 +100,13 @@ Y_UNIT_TEST_SUITE(Replication)
97100
if (res.first == 1) {
98101
const Ydb::ResultSet& proto = res.second;
99102
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(0).uint32_value(), 1);
100-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedV1.Buf_.Halfs[0]);
101-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedV1.Buf_.Halfs[1]);
102-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV2.Buf_.Halfs[0]);
103-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV2.Buf_.Halfs[1]);
104-
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(3).double_value(), expectedV3, 0.0001);
103+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedKey2.Buf_.Halfs[0]);
104+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedKey2.Buf_.Halfs[1]);
105+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV1.Buf_.Halfs[0]);
106+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV1.Buf_.Halfs[1]);
107+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).low_128(), expectedV2.Buf_.Halfs[0]);
108+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).high_128(), expectedV2.Buf_.Halfs[1]);
109+
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(4).double_value(), expectedV3, 0.0001);
105110
break;
106111
}
107112
Sleep(TDuration::Seconds(1));

0 commit comments

Comments
 (0)