Skip to content

Commit 7e86ea9

Browse files
committed
tx_proxy: add tests for admin restrictions
1 parent ca7d1f4 commit 7e86ea9

File tree

6 files changed

+808
-1
lines changed

6 files changed

+808
-1
lines changed

ydb/core/testlib/test_client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,6 +2671,9 @@ namespace Tests {
26712671
TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> request(new NMsgBusProxy::TBusBlobStorageConfigRequest());
26722672
request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
26732673
request->Record.SetDomain(Domain);
2674+
if (SecurityToken) {
2675+
request->Record.SetSecurityToken(SecurityToken);
2676+
}
26742677

26752678
TAutoPtr<NBus::TBusMessage> reply;
26762679
NBus::EMessageStatus msgStatus = SendWhenReady(request, reply);

ydb/core/testlib/test_client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ namespace Tests {
291291
FeatureFlags.SetEnableColumnStore(true);
292292
}
293293

294+
TServerSettings() = default;
294295
TServerSettings(const TServerSettings& settings) = default;
295296
TServerSettings& operator=(const TServerSettings& settings) = default;
296297
private:

ydb/core/tx/tx_proxy/proxy_ut_helpers.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@
2323
template<bool OPT> \
2424
void Test##N(NUnitTest::TTestContext&)
2525

26+
#define Y_UNIT_TEST_FLAGS(N, OPT1, OPT2) \
27+
template<bool OPT1, bool OPT2> void N(NUnitTest::TTestContext&); \
28+
struct TTestRegistration##N { \
29+
TTestRegistration##N() { \
30+
TCurrentTest::AddTest(#N, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, false>), false); \
31+
TCurrentTest::AddTest(#N "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<false, true>), false); \
32+
TCurrentTest::AddTest(#N "-" #OPT1, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, false>), false); \
33+
TCurrentTest::AddTest(#N "-" #OPT1 "-" #OPT2, static_cast<void (*)(NUnitTest::TTestContext&)>(&N<true, true>), false); \
34+
} \
35+
}; \
36+
static TTestRegistration##N testRegistration##N; \
37+
template<bool OPT1, bool OPT2> \
38+
void N(NUnitTest::TTestContext&)
39+
2640

2741
namespace NKikimr {
2842
namespace NTxProxyUT {
@@ -112,10 +126,14 @@ class TBaseTestEnv {
112126

113127
class TTestEnv: public TBaseTestEnv {
114128
public:
115-
TTestEnv(ui32 staticNodes = 1, ui32 dynamicNodes = 0)
129+
TTestEnv(ui32 staticNodes = 1, ui32 dynamicNodes = 0, const std::optional<NKikimrConfig::TFeatureFlags>& featureFlags = std::nullopt)
116130
{
117131
Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
118132

133+
if (featureFlags) {
134+
GetSettings().SetFeatureFlags(*featureFlags);
135+
}
136+
119137
GetSettings().SetNodeCount(staticNodes);
120138
GetSettings().SetDynamicNodeCount(dynamicNodes);
121139

0 commit comments

Comments
 (0)