PEL: Close PEL FD after getPEL call

To close the file descriptor returned from the getPEL D-Bus method call,
use the 'Defer' sdeventplus object to schedule it to happen from the
event loop.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I2b850a1c92215e7f66166cc5440d7071663065c0
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index 3036f30..8f3df22 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -28,6 +28,21 @@
 
 class ManagerTest : public CleanPELFiles
 {
+  public:
+    ManagerTest() : logManager(bus, "logging_path")
+    {
+        sd_event_default(&sdEvent);
+        bus.attach_event(sdEvent, SD_EVENT_PRIORITY_NORMAL);
+    }
+
+    ~ManagerTest()
+    {
+        sd_event_unref(sdEvent);
+    }
+
+    sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
+    phosphor::logging::internal::Manager logManager;
+    sd_event* sdEvent;
 };
 
 fs::path makeTempDir()
@@ -56,8 +71,6 @@
 // a PEL saved in the repository.
 TEST_F(ManagerTest, TestCreateWithPEL)
 {
-    auto bus = sdbusplus::bus::new_default();
-    phosphor::logging::internal::Manager logManager(bus, "logging_path");
     std::unique_ptr<DataInterfaceBase> dataIface =
         std::make_unique<DataInterface>(bus);
 
@@ -170,8 +183,6 @@
 
 TEST_F(ManagerTest, TestDBusMethods)
 {
-    auto bus = sdbusplus::bus::new_default();
-    phosphor::logging::internal::Manager logManager(bus, "logging_path");
     std::unique_ptr<DataInterfaceBase> dataIface =
         std::make_unique<DataInterface>(bus);