sync code

This commit is contained in:
Ned Wright
2026-01-03 18:59:01 +00:00
parent c1058db57d
commit 2105628f05
188 changed files with 8272 additions and 2723 deletions

View File

@@ -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();

View File

@@ -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"));