test: Always create unique tmpdirs

This ensures our tests always have clear temporary directories to store
their files.

Change-Id: Ib755c4a9407b1e1925b34ae1537eb234542133b0
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
index 913b6e1..0846f7e 100644
--- a/test/test_ethernet_interface.cpp
+++ b/test/test_ethernet_interface.cpp
@@ -12,6 +12,7 @@
 #include <exception>
 #include <fstream>
 #include <sdbusplus/bus.hpp>
+#include <stdplus/gtest/tmp.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 #include <gtest/gtest.h>
@@ -21,35 +22,19 @@
 namespace network
 {
 
-class TestEthernetInterface : public testing::Test
+class TestEthernetInterface : public stdplus::gtest::TestWithTmp
 {
   public:
     sdbusplus::bus::bus bus;
+    std::string confDir;
     MockManager manager;
     MockEthernetInterface interface;
-    std::string confDir;
     TestEthernetInterface() :
-        bus(sdbusplus::bus::new_default()),
-        manager(bus, "/xyz/openbmc_test/network", "/tmp/"),
+        bus(sdbusplus::bus::new_default()), confDir(CaseTmpDir()),
+        manager(bus, "/xyz/openbmc_test/network", confDir),
         interface(makeInterface(bus, manager))
 
     {
-        setConfDir();
-    }
-
-    void setConfDir()
-    {
-        char tmp[] = "/tmp/EthernetInterface.XXXXXX";
-        confDir = mkdtemp(tmp);
-        manager.setConfDir(confDir);
-    }
-
-    ~TestEthernetInterface()
-    {
-        if (confDir != "")
-        {
-            fs::remove_all(confDir);
-        }
     }
 
     static constexpr ether_addr mac{0x11, 0x22, 0x33, 0x44, 0x55, 0x66};