|
3 | 3 |
|
4 | 4 | #include <ydb/core/tx/replication/ut_helpers/test_env.h>
|
5 | 5 | #include <ydb/core/tx/replication/ut_helpers/test_table.h>
|
| 6 | +#include <ydb/core/tx/replication/ydb_proxy/ydb_proxy.h> |
6 | 7 |
|
7 | 8 | #include <library/cpp/testing/unittest/registar.h>
|
8 | 9 |
|
@@ -130,6 +131,33 @@ Y_UNIT_TEST_SUITE(TargetDiscoverer) {
|
130 | 131 | UNIT_ASSERT_VALUES_EQUAL(toAdd.size(), 1);
|
131 | 132 | UNIT_ASSERT_VALUES_EQUAL(toAdd.at(0).SrcPath, "/Root/Table");
|
132 | 133 | }
|
| 134 | + |
| 135 | + Y_UNIT_TEST(InvalidCredentials) { |
| 136 | + TEnv env; |
| 137 | + env.GetRuntime().SetLogPriority(NKikimrServices::REPLICATION_CONTROLLER, NLog::PRI_TRACE); |
| 138 | + |
| 139 | + env.CreateTable("/Root", *MakeTableDescription(DummyTable())); |
| 140 | + |
| 141 | + // create aux proxy |
| 142 | + NKikimrReplication::TStaticCredentials staticCreds; |
| 143 | + staticCreds.SetUser("user"); |
| 144 | + staticCreds.SetPassword("password"); |
| 145 | + const auto ydbProxy = env.GetRuntime().Register(CreateYdbProxy( |
| 146 | + env.GetEndpoint(), env.GetDatabase(), false /* ssl */, staticCreds)); |
| 147 | + |
| 148 | + env.GetRuntime().Register(CreateTargetDiscoverer(env.GetSender(), 1, ydbProxy, |
| 149 | + TVector<std::pair<TString, TString>>{ |
| 150 | + {"/Root", "/Root/Replicated"}, |
| 151 | + } |
| 152 | + )); |
| 153 | + |
| 154 | + auto ev = env.GetRuntime().GrabEdgeEvent<TEvPrivate::TEvDiscoveryTargetsResult>(env.GetSender()); |
| 155 | + UNIT_ASSERT(!ev->Get()->IsSuccess()); |
| 156 | + |
| 157 | + const auto& failed = ev->Get()->Failed; |
| 158 | + UNIT_ASSERT_VALUES_EQUAL(failed.size(), 1); |
| 159 | + UNIT_ASSERT_VALUES_EQUAL(failed.at(0).Error.GetStatus(), NYdb::EStatus::CLIENT_UNAUTHENTICATED); |
| 160 | + } |
133 | 161 | }
|
134 | 162 |
|
135 | 163 | }
|
0 commit comments