Re: [Openvpn-devel] [PATCH applied openvpn3-linux] tests: platforminfo: skip DBus test if hostname service isn't available

2022-12-01 Thread Frans Klaver
On Thu, Dec 1, 2022 at 1:44 PM David Sommerseth
 wrote:
>
> From: David Sommerseth 
>
> Thanks a lot!  This patch was a by the book in every possible way, so
> this was really easy to review and apply.
>
> Acked-by: David Sommerseth 

The submission instructions were pretty clear. That helps.

Thanks for applying.

Frans


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH openvpn3-linux] tests: platforminfo: skip DBus test if hostname service isn't available

2022-11-30 Thread Frans Klaver
The dbus test is dependent on the org.freedesktop.hostname1 service
being present. If that isn't there, we really can't determine whether or
not the PlatformInfo code does what it's supposed to do.

So try to determine whether or not it makes sense to execute this test
in the first place.

Signed-off-by: Frans Klaver 
---
 src/tests/unit/platforminfo.cpp | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/tests/unit/platforminfo.cpp b/src/tests/unit/platforminfo.cpp
index 453de63..1460367 100644
--- a/src/tests/unit/platforminfo.cpp
+++ b/src/tests/unit/platforminfo.cpp
@@ -45,6 +45,20 @@ TEST(PlatformInfo, DBus)
 }
 
 PlatformInfo plinfo(dbc.GetConnection());
+
+try
+{
+plinfo.GetStringProperty("OperatingSystemCPEName");
+}
+catch (const DBusException& e)
+{
+const std::string what{e.what()};
+if (what.find("was not provided by any") != std::string::npos)
+{
+GTEST_SKIP() << "A required service isn't available ## " + what;
+}
+}
+
 std::string s{plinfo.str()};
 ASSERT_TRUE(s.find("generic:") == std::string::npos)
 << "PlatformInfo D-Bus call failed";
-- 
2.38.1



___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel