@@ -5701,130 +5701,147 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
5701
5701
auto db = kikimr.GetTableClient ();
5702
5702
auto session = db.CreateSession ().GetValueSync ().GetSession ();
5703
5703
5704
- // connection string & endpoint/database are mutually exclusive
5704
+ // negative
5705
5705
{
5706
5706
auto query = R"(
5707
5707
--!syntax_v1
5708
5708
CREATE ASYNC REPLICATION `/Root/replication` FOR
5709
5709
`/Root/table` AS `/Root/replica`
5710
5710
WITH (
5711
- CONNECTION_STRING = "grpc://localhost:2135/?database=/Root"
5711
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5712
5712
ENDPOINT = "localhost:2135",
5713
5713
DATABASE = "/Root"
5714
5714
);
5715
5715
)" ;
5716
5716
5717
5717
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5718
5718
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5719
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " CONNECTION_STRING and ENDPOINT/DATABASE are mutually exclusive" );
5719
5720
}
5720
5721
{
5721
5722
auto query = R"(
5722
5723
--!syntax_v1
5723
5724
CREATE ASYNC REPLICATION `/Root/replication` FOR
5724
5725
`/Root/table` AS `/Root/replica`
5725
5726
WITH (
5726
- DATABASE = "/Root "
5727
+ ENDPOINT = "localhost:2135 "
5727
5728
);
5728
5729
)" ;
5729
5730
5730
5731
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5731
5732
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5733
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " Neither CONNECTION_STRING nor ENDPOINT/DATABASE are provided" );
5732
5734
}
5733
-
5734
- // token & user/password are mutually exclusive
5735
5735
{
5736
5736
auto query = R"(
5737
5737
--!syntax_v1
5738
5738
CREATE ASYNC REPLICATION `/Root/replication` FOR
5739
5739
`/Root/table` AS `/Root/replica`
5740
5740
WITH (
5741
- TOKEN = "foo",
5742
- USER = "user",
5743
- PASSWORD = "bar"
5741
+ DATABASE = "/Root"
5744
5742
);
5745
5743
)" ;
5746
5744
5747
5745
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5748
5746
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5747
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " Neither CONNECTION_STRING nor ENDPOINT/DATABASE are provided" );
5749
5748
}
5750
5749
{
5751
5750
auto query = R"(
5752
5751
--!syntax_v1
5753
5752
CREATE ASYNC REPLICATION `/Root/replication` FOR
5754
5753
`/Root/table` AS `/Root/replica`
5755
5754
WITH (
5756
- CONNECTION_STRING = "grpc://localhost:2135/?database=/Root"
5755
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5756
+ TOKEN = "foo",
5757
+ USER = "user",
5758
+ PASSWORD = "bar"
5757
5759
);
5758
5760
)" ;
5759
5761
5760
5762
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5761
5763
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5764
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " TOKEN and USER/PASSWORD are mutually exclusive" );
5762
5765
}
5763
-
5764
- // token & token_secret_name are mutually exclusive
5765
5766
{
5766
5767
auto query = R"(
5767
5768
--!syntax_v1
5768
5769
CREATE ASYNC REPLICATION `/Root/replication` FOR
5769
5770
`/Root/table` AS `/Root/replica`
5770
5771
WITH (
5772
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5771
5773
TOKEN = "foo",
5772
5774
TOKEN_SECRET_NAME = "bar"
5773
5775
);
5774
5776
)" ;
5775
5777
5776
5778
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5777
5779
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5780
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " TOKEN and TOKEN_SECRET_NAME are mutually exclusive" );
5778
5781
}
5779
-
5780
- // password & password_secret_name are mutually exclusive
5781
5782
{
5782
5783
auto query = R"(
5783
5784
--!syntax_v1
5784
5785
CREATE ASYNC REPLICATION `/Root/replication` FOR
5785
5786
`/Root/table` AS `/Root/replica`
5786
5787
WITH (
5788
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5787
5789
USER = "user",
5788
- PASSWORD = "bar"
5790
+ PASSWORD = "bar",
5789
5791
PASSWORD_SECRET_NAME = "baz"
5790
5792
);
5791
5793
)" ;
5792
5794
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5793
5795
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5796
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " PASSWORD and PASSWORD_SECRET_NAME are mutually exclusive" );
5794
5797
}
5795
-
5796
- // password set & user is not set
5797
5798
{
5798
5799
auto query = R"(
5799
5800
--!syntax_v1
5800
5801
CREATE ASYNC REPLICATION `/Root/replication` FOR
5801
5802
`/Root/table` AS `/Root/replica`
5802
5803
WITH (
5804
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5803
5805
PASSWORD = "bar"
5804
5806
);
5805
5807
)" ;
5806
5808
5807
5809
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5808
5810
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5811
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " USER is not provided" );
5809
5812
}
5813
+ {
5814
+ auto query = R"(
5815
+ --!syntax_v1
5816
+ CREATE ASYNC REPLICATION `/Root/replication` FOR
5817
+ `/Root/table` AS `/Root/replica`
5818
+ WITH (
5819
+ CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5820
+ USER = "user"
5821
+ );
5822
+ )" ;
5810
5823
5811
- // unsupported setting (STATE) in CREATE
5824
+ const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5825
+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5826
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " PASSWORD or PASSWORD_SECRET_NAME are not provided" );
5827
+ }
5812
5828
{
5813
5829
auto query = R"(
5814
5830
--!syntax_v1
5815
5831
CREATE ASYNC REPLICATION `/Root/replication` FOR
5816
5832
`/Root/table` AS `/Root/replica`
5817
5833
WITH (
5818
5834
CONNECTION_STRING = "grpc://localhost:2135/?database=/Root",
5819
- TOKEN = "root@builtin",
5820
5835
STATE = "DONE"
5821
5836
);
5822
5837
)" ;
5823
5838
5824
5839
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5825
5840
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
5841
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " STATE is not supported in CREATE" );
5826
5842
}
5827
5843
5844
+ // positive
5828
5845
{
5829
5846
auto query = R"(
5830
5847
--!syntax_v1
@@ -5838,17 +5855,14 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
5838
5855
auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
5839
5856
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
5840
5857
}
5841
-
5842
- // ok
5843
5858
{
5844
5859
auto query = Sprintf (R"(
5845
5860
--!syntax_v1
5846
5861
CREATE ASYNC REPLICATION `/Root/replication` FOR
5847
5862
`/Root/table` AS `/Root/replica`
5848
5863
WITH (
5849
5864
ENDPOINT = "%s",
5850
- DATABASE = "/Root",
5851
- TOKEN = "root@builtin"
5865
+ DATABASE = "/Root"
5852
5866
);
5853
5867
)" , kikimr.GetEndpoint ().c_str ());
5854
5868
@@ -6080,7 +6094,6 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6080
6094
}
6081
6095
}
6082
6096
6083
-
6084
6097
// Connection string and Endpoint/Database are mutually exclusive
6085
6098
{
6086
6099
auto query = R"(
@@ -6095,7 +6108,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6095
6108
6096
6109
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
6097
6110
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
6098
- UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " Connection string and Endpoint/Database are mutually exclusive" );
6111
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " CONNECTION_STRING and ENDPOINT/DATABASE are mutually exclusive" );
6099
6112
}
6100
6113
6101
6114
// alter connection params
@@ -6152,7 +6165,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6152
6165
6153
6166
const auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
6154
6167
UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
6155
- UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " Token and User/Password are mutually exclusive" );
6168
+ UNIT_ASSERT_STRING_CONTAINS (result.GetIssues ().ToOneLineString (), " TOKEN and USER/PASSWORD are mutually exclusive" );
6156
6169
}
6157
6170
6158
6171
// TOKEN and TOKEN_SECRET_NAME are mutually exclusive
@@ -6336,8 +6349,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6336
6349
`/Root/table` AS `/Root/replica`
6337
6350
WITH (
6338
6351
ENDPOINT = "%s",
6339
- DATABASE = "/Root",
6340
- TOKEN = "root@builtin"
6352
+ DATABASE = "/Root"
6341
6353
);
6342
6354
)" , kikimr.GetEndpoint ().c_str ());
6343
6355
@@ -6395,8 +6407,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6395
6407
`/Root/table` AS `/Root/replica`
6396
6408
WITH (
6397
6409
ENDPOINT = "%s",
6398
- DATABASE = "/Root",
6399
- TOKEN = "root@builtin"
6410
+ DATABASE = "/Root"
6400
6411
);
6401
6412
)" , kikimr.GetEndpoint ().c_str ());
6402
6413
@@ -6450,7 +6461,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
6450
6461
CREATE ASYNC REPLICATION `/Root/replication` FOR
6451
6462
`/Root/table` AS `/Root/replica`
6452
6463
WITH (
6453
- %s, TOKEN = "root@builtin"
6464
+ %s
6454
6465
);
6455
6466
)" , connectionParam.c_str ());
6456
6467
0 commit comments