Use proper errors when failing to set time
Previously it reports InsufficientPermission when it is not allowed to
set time.
Now phosphor-dbus-interfaces defines proper errors for such case, so
report NotAllowed error when it is not allowed to set time, and report
Failed error when it failed to set time.
Tested: Get NotAllowed and Failed error with expected metadata from
journal log.
Change-Id: I53610bf27ffc3f62608cea6fd0e66ca859d94675
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/test/TestHostEpoch.cpp b/test/TestHostEpoch.cpp
index 6c460ad..1004dad 100644
--- a/test/TestHostEpoch.cpp
+++ b/test/TestHostEpoch.cpp
@@ -3,7 +3,7 @@
#include "config.h"
#include "types.hpp"
-#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Time/error.hpp>
#include <sdbusplus/bus.hpp>
#include <gtest/gtest.h>
@@ -16,8 +16,8 @@
using namespace std::chrono;
using namespace std::chrono_literals;
-using InsufficientPermission =
- sdbusplus::xyz::openbmc_project::Common::Error::InsufficientPermission;
+using NotAllowed =
+ sdbusplus::xyz::openbmc_project::Time::Error::NotAllowed;
const constexpr microseconds USEC_ZERO{0};
@@ -80,7 +80,7 @@
microseconds diff = 1min;
EXPECT_THROW(
hostEpoch.elapsed(hostEpoch.elapsed() + diff.count()),
- InsufficientPermission);
+ NotAllowed);
EXPECT_EQ(0, getOffset().count());
}