mirror of
https://github.com/openappsec/openappsec.git
synced 2026-01-17 16:00:26 +03:00
sync code
This commit is contained in:
@@ -211,6 +211,8 @@ CPUManager::init()
|
||||
}
|
||||
}
|
||||
|
||||
registerConfigLoadCb([this]() { loadCPUConfig(); });
|
||||
|
||||
i_mainloop->addOneTimeRoutine(
|
||||
I_MainLoop::RoutineType::Timer,
|
||||
[this]() { checkCPUStatus(); },
|
||||
@@ -265,8 +267,6 @@ void
|
||||
CPUManager::checkCPUStatus()
|
||||
{
|
||||
while (true) {
|
||||
loadCPUConfig();
|
||||
|
||||
auto is_orchestrator = Singleton::Consume<I_Environment>::by<CPUManager>()->get<bool>("Is Orchestrator");
|
||||
if (is_orchestrator.ok() && is_orchestrator.unpack()) {
|
||||
Maybe<double> current_general_cpu = i_cpu->getCurrentGeneralCPUUsage();
|
||||
|
||||
@@ -47,8 +47,6 @@ public:
|
||||
StrictMock<MockMainLoop> mock_ml;
|
||||
StrictMock<MockTimeGet> mock_time;
|
||||
I_Environment *i_env;
|
||||
|
||||
private:
|
||||
ConfigComponent conf;
|
||||
::Environment env;
|
||||
};
|
||||
@@ -261,8 +259,24 @@ TEST_F(CPUTest, noDebugTest)
|
||||
StrictMock<MockCPU> mock_cpu;
|
||||
CPUManager cpu;
|
||||
cpu.preload();
|
||||
setConfiguration<uint>(0, string("CPU"), string("debug period"));
|
||||
cpu.init();
|
||||
// Test loadConfiguration functionality like in compression_ut
|
||||
string config_json =
|
||||
"{"
|
||||
" \"CPU\": {"
|
||||
" \"debug period\": ["
|
||||
" {"
|
||||
" \"value\": 0"
|
||||
" }"
|
||||
" ]"
|
||||
" }"
|
||||
"}";
|
||||
istringstream ss(config_json);
|
||||
Singleton::Consume<Config::I_Config>::from(conf)->loadConfiguration(ss);
|
||||
|
||||
auto loaded_debug_period = getConfiguration<uint>("CPU", "debug period");
|
||||
EXPECT_TRUE(loaded_debug_period.ok());
|
||||
EXPECT_EQ((int)loaded_debug_period.unpack(), 0);
|
||||
|
||||
doFWError();
|
||||
EXPECT_THAT(debug_output.str(), HasSubstr("!!!] FW error message\n"));
|
||||
|
||||
Reference in New Issue
Block a user