Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yegorskii committed Aug 6, 2024
1 parent f8dc878 commit d1e5077
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions cloud/filestore/libs/daemon/server/config_initializer_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "config_initializer.h"
#include "options.h"

#include <cloud/filestore/libs/diagnostics/config.h>
#include <cloud/filestore/libs/server/config.h>
#include <cloud/filestore/libs/storage/core/config.h>

#include <library/cpp/monlib/dynamic_counters/counters.h>
#include <library/cpp/protobuf/util/pb_io.h>
#include <library/cpp/testing/unittest/registar.h>
Expand Down Expand Up @@ -90,6 +94,62 @@ Y_UNIT_TEST_SUITE(TConfigInitializerTest)
logConfig.GetEntry(1).GetComponent());
UNIT_ASSERT_VALUES_EQUAL(6, logConfig.GetEntry(1).GetLevel());
}

Y_UNIT_TEST(ShouldApplyConfigsFromCms)
{
auto options = CreateOptions();

auto ci = TConfigInitializerServer(std::move(options));

NKikimrConfig::TAppConfig appConfig;

auto* storageConfig = appConfig.AddNamedConfigs();
storageConfig->SetName("StorageConfig");
storageConfig->SetConfig(R"(
NodeType: "xyz"
)");

auto* diagConfig = appConfig.AddNamedConfigs();
diagConfig->SetName("DiagnosticsConfig");
diagConfig->SetConfig(R"(
BastionNameSuffix: "xyz"
)");

auto* featuresConfig = appConfig.AddNamedConfigs();
featuresConfig->SetName("FeaturesConfig");
featuresConfig->SetConfig(R"(
Features {
Name: "xyz"
Value: "None"
}
)");

auto* serverAppConfig = appConfig.AddNamedConfigs();
serverAppConfig->SetName("ServerAppConfig");
serverAppConfig->SetConfig(R"(
ServerConfig {
Host: "xyz.cloud"
}
)");

ci.ApplyCustomCMSConfigs(appConfig);
/*
UNIT_ASSERT_VALUES_EQUAL(
"xyz",
ci.StorageConfig->GetNodeType());
*/
UNIT_ASSERT_VALUES_EQUAL(
"xyz",
ci.DiagnosticsConfig->GetBastionNameSuffix());

UNIT_ASSERT_VALUES_EQUAL(
"None",
ci.FeaturesConfig->GetFeatureValue("", "", "", "xyz"));

UNIT_ASSERT_VALUES_EQUAL(
"xyz.cloud",
ci.ServerConfig->GetHost());
}
}

} // namespace NCloud::NFileStore::NDaemon

0 comments on commit d1e5077

Please sign in to comment.