Skip to content

Commit

Permalink
17298 Windows agent reports the version of custom exe plugin as n/a
Browse files Browse the repository at this point in the history
For any exe plugin except for mk-sql.exe, the version is reported as n/a.
For mk-sql.exe, its actual version is reported.

Change-Id: Ifdafc4c28f87400e3d51f483687e1a876948502d
  • Loading branch information
s-kipnis committed Jan 14, 2025
1 parent a19f62d commit 0e50788
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .werks/17298.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[//]: # (werk v2)
# Windows agent reports the version of custom exe plugin as n/a

key | value
---------- | ---
date | 2025-01-14T07:58:04+00:00
version | 2.4.0b1
class | feature
edition | cre
component | checks
level | 1
compatible | yes

For any exe plugin except for mk-sql.exe, the version is reported as n/a.
For mk-sql.exe, its actual version is reported.
2 changes: 2 additions & 0 deletions agents/wnx/src/engine/providers/agent_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ std::string FindVersionInfo(const fs::path &file, FileType file_type) {
return fmt::format("{}:CMK_VERSION = \"{}\"", file,
output[1]);
}
} else {
return fmt::format("{}:CMK_VERSION = n/a", file);
}
return {};
}
Expand Down
10 changes: 10 additions & 0 deletions agents/wnx/watest/test-section_agent_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ TEST_F(AgentPluginsTest, File) {
}));
}

TEST_F(AgentPluginsTest, JustExe) {
auto ps_file = fs::path{cfg::GetUserPluginsDir()} / "empty.exe";
tst::CreateTextFile(ps_file, "");
auto rows = getRows();
ASSERT_EQ(rows.size(), 4);
EXPECT_TRUE(std::ranges::any_of(rows, [&](const std::string &row) {
return row == fmt::format("{}:CMK_VERSION = n/a", ps_file);
}));
}

TEST_F(AgentPluginsTest, DISABLED_Exe) {
// Test is disabled because we need a binary to build: not appropriate for
// unit testing. You may enable this test manually
Expand Down

0 comments on commit 0e50788

Please sign in to comment.