Fixes to get unit tests to compile
There are 2 CI failures that started showing up at the same time:
1) sdbusplus recenty had a commit that started checking the return code
on sd_bus_add_object_vtable and now 2 tests are getting those fails
in CI, so used the mocked bus objects instead.
2) pel_values_test.cpp fails with:
Expected equality of these values:
"cec_service_network"
Which is: 0x563efae570fc
std::get<registryNamePos>(*s)
Which is: 0x563efae57a64
because it is using EXPECT_EQ to compare to char* values instead of
EXPECT_STREQ. I'm not sure what changed that uncovered this.
Fix them both at the same time as CI won't pass when doing them
separately because of the other error.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I937bd6d6965be5c8aab26f6c539cf30537439e0b
diff --git a/test/extensions_test.cpp b/test/extensions_test.cpp
index d210115..6dfe9be 100644
--- a/test/extensions_test.cpp
+++ b/test/extensions_test.cpp
@@ -1,6 +1,8 @@
#include "elog_entry.hpp"
#include "extensions.hpp"
+#include <sdbusplus/test/sdbus_mock.hpp>
+
#include <gtest/gtest.h>
using namespace phosphor::logging;
@@ -63,7 +65,8 @@
TEST(ExtensionsTest, FunctionCallTest)
{
- auto bus = sdbusplus::bus::new_default();
+ sdbusplus::SdBusMock sdbusMock;
+ sdbusplus::bus::bus bus = sdbusplus::get_mocked_new(&sdbusMock);
internal::Manager manager(bus, "testpath");
EXPECT_EQ(Extensions::getStartupFunctions().size(), 2);