Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit ef9a966

Browse files
committed
remove some warnings
1 parent f738363 commit ef9a966

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

engine/cli/commands/cortex_upd_cmd.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,12 @@ std::optional<std::string> CheckNewUpdate(
175175
CTL_INF("Got the latest release, update to the config file: "
176176
<< latest_version)
177177
config.latestRelease = latest_version;
178-
config_yaml_utils::DumpYamlConfig(
178+
auto result = config_yaml_utils::DumpYamlConfig(
179179
config, file_manager_utils::GetConfigurationPath().string());
180+
if (result.has_error()) {
181+
CTL_ERR("Error update " << file_manager_utils::GetConfigurationPath()
182+
<< result.error());
183+
}
180184
if (current_version != latest_version) {
181185
return latest_version;
182186
}

engine/test/components/test_cortex_config.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ TEST_F(CortexConfigTest, DumpYamlConfig_WritesCorrectly) {
4141
123456789,
4242
"v1.0.0"};
4343

44-
DumpYamlConfig(config, test_file_path);
44+
auto result = DumpYamlConfig(config, test_file_path);
45+
EXPECT_FALSE(result.has_error());
4546

4647
// Verify that the file was created and contains the expected data
4748
YAML::Node node = YAML::LoadFile(test_file_path);
@@ -68,7 +69,8 @@ TEST_F(CortexConfigTest, FromYaml_ReadsCorrectly) {
6869
123456789,
6970
"v1.0.0"};
7071

71-
DumpYamlConfig(config, test_file_path);
72+
auto result = DumpYamlConfig(config, test_file_path);
73+
EXPECT_FALSE(result.has_error());
7274

7375
// Now read from the YAML file
7476
CortexConfig loaded_config = FromYaml(test_file_path, default_config);
@@ -115,4 +117,4 @@ TEST_F(CortexConfigTest, FromYaml_IncompleteConfigUsesDefaults) {
115117
default_config.latestRelease); // Default value
116118
}
117119

118-
} // namespace config_yaml_utils
120+
} // namespace config_yaml_utils

engine/test/components/test_file_manager_config_yaml_utils.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ TEST_F(FileManagerConfigTest, GetDefaultDataFolderName) {
3737

3838
TEST_F(FileManagerConfigTest, CreateConfigFileIfNotExist) {
3939

40-
file_manager_utils::CreateConfigFileIfNotExist();
40+
auto result = file_manager_utils::CreateConfigFileIfNotExist();
41+
EXPECT_FALSE(result.has_error());
4142
EXPECT_TRUE(
4243
std::filesystem::exists(file_manager_utils::GetConfigurationPath()));
4344
std::filesystem::remove(file_manager_utils::GetConfigurationPath());
4445
}
4546

4647
TEST_F(FileManagerConfigTest, GetCortexConfig) {
47-
file_manager_utils::CreateConfigFileIfNotExist();
48+
auto result = file_manager_utils::CreateConfigFileIfNotExist();
49+
EXPECT_FALSE(result.has_error());
4850
auto config = file_manager_utils::GetCortexConfig();
4951
EXPECT_FALSE(config.dataFolderPath.empty());
5052
EXPECT_FALSE(config.logFolderPath.empty());
@@ -61,8 +63,8 @@ TEST_F(FileManagerConfigTest, DumpYamlConfig) {
6163
.apiServerPort = "8080"};
6264

6365
std::string test_file = "test_config.yaml";
64-
config_yaml_utils::DumpYamlConfig(config, test_file);
65-
66+
auto result = config_yaml_utils::DumpYamlConfig(config, test_file);
67+
EXPECT_FALSE(result.has_error());
6668
EXPECT_TRUE(std::filesystem::exists(test_file));
6769

6870
// Clean up
@@ -91,4 +93,4 @@ TEST_F(FileManagerConfigTest, FromYaml) {
9193

9294
// Clean up
9395
std::filesystem::remove(test_file);
94-
}
96+
}

0 commit comments

Comments
 (0)