test: unit test fixes for vtable exception
Seeing the following unit test failures due to duplicate
objects being put onto the dbus. This is likely due to a
change in an underlying library to be more stringent. Changed
the object path for the second objects to avoid the exception.
[ RUN ] TestSNMPClient.CheckPersistency
unknown file: Failure
C++ exception with description "sd_bus_add_object_vtable:
org.freedesktop.DBus.Error.FileExists: File exists" thrown in the test body.
[ FAILED ] TestSNMPClient.CheckPersistency (0 ms)
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I16f06cc1249ebc2c6957b8429141ba0d02b05fb9
diff --git a/test/test_snmp_client.cpp b/test/test_snmp_client.cpp
index fe49f2b..04fbdf8 100644
--- a/test/test_snmp_client.cpp
+++ b/test/test_snmp_client.cpp
@@ -65,11 +65,13 @@
{
std::string objPath = mgrObjPath;
objPath += "/" + std::to_string(1);
+ std::string objPath2 = mgrObjPath;
+ objPath2 += "/" + std::to_string(2);
Client client(bus, objPath.c_str(), manager, "1.1.1.1", 23);
client.address("2.2.2.2");
- Client restoreClient(bus, objPath.c_str(), manager);
+ Client restoreClient(bus, objPath2.c_str(), manager);
auto persistentPath = manager.dbusPersistentLocation;
persistentPath += "/1";
deserialize(persistentPath, restoreClient);
diff --git a/test/test_snmp_serialize.cpp b/test/test_snmp_serialize.cpp
index df27b5b..c276cb1 100644
--- a/test/test_snmp_serialize.cpp
+++ b/test/test_snmp_serialize.cpp
@@ -41,11 +41,13 @@
{
std::string objPath = clientObjPath;
objPath += "/" + std::to_string(1);
+ std::string objPath2 = clientObjPath;
+ objPath2 += "/" + std::to_string(2);
Client client(bus, objPath.c_str(), manager, "1.1.1.1", 23);
auto path = serialize(1, client, manager.dbusPersistentLocation);
- Client restoreClient(bus, objPath.c_str(), manager);
+ Client restoreClient(bus, objPath2.c_str(), manager);
deserialize(path, restoreClient);