Message ID | 20221201075013.30946-1-fransklaver@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Sommerseth |
Headers | show |
Series | [Openvpn-devel,openvpn3-linux] tests: platforminfo: skip DBus test if hostname service isn't available | expand |
From: David Sommerseth <davids@openvpn.net> 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 <davids@openvpn.net> --------------------------------------------------------------------- Your patch has been applied commit 1576e34a1f45133bd4c6df495eaef9387ecd1b4d master Author: Frans Klaver Date: Thu, 01 Dec 2022 07:50:13 +0000 tests: platforminfo: skip DBus test if hostname service isn't available Signed-off-by: Frans Klaver Acked-by: David Sommerseth Patchwork-Id: 2880 URL: https://patchwork.openvpn.net/patch/2880/ -- kind regards, David Sommerseth
On Thu, Dec 1, 2022 at 1:44 PM David Sommerseth <openvpn@sf.lists.topphemmelig.net> wrote: > > From: David Sommerseth <davids@openvpn.net> > > 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 <davids@openvpn.net> The submission instructions were pretty clear. That helps. Thanks for applying. Frans
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";
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 <fransklaver@gmail.com> --- src/tests/unit/platforminfo.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+)