This is an automated email from the ASF dual-hosted git repository.

mmartell pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new e6ffd8e  GEODE-8449: Cleanup containers before each test (#649)
e6ffd8e is described below

commit e6ffd8e213b940dc332d657f618b4941fa7dea33
Author: Michael Martell <[email protected]>
AuthorDate: Thu Sep 10 16:14:40 2020 -0700

    GEODE-8449: Cleanup containers before each test (#649)
    
    * Cleanup containers before each test
    - in case a test fails to cleanup
    
    * Cleanup test structure per review.
---
 clicache/acceptance-test/SNITests.cs | 17 +++++++++++------
 cppcache/acceptance-test/SNITest.cpp |  6 +++++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/clicache/acceptance-test/SNITests.cs 
b/clicache/acceptance-test/SNITests.cs
index cb20f31..f459716 100644
--- a/clicache/acceptance-test/SNITests.cs
+++ b/clicache/acceptance-test/SNITests.cs
@@ -34,6 +34,8 @@ namespace Apache.Geode.Client.IntegrationTests
 
         public SNITests(ITestOutputHelper testOutputHelper) : 
base(testOutputHelper)
         {
+                       CleanupDocker();
+
             currentWorkingDirectory = Directory.GetCurrentDirectory();
             var clientTruststore = Config.SslClientKeyPath + 
@"/truststore_sni.pem";
 
@@ -56,14 +58,17 @@ namespace Apache.Geode.Client.IntegrationTests
 
         public void Dispose()
         {
+                       CleanupDocker();
+               }
 
-            var dockerComposeProc = Process.Start(@"docker-compose.exe", "-f " 
+ Config.SniConfigPath + "/docker-compose.yml" + " stop");
-            dockerComposeProc.WaitForExit();
-
-            var dockerProc = Process.Start(@"docker.exe", "system prune -f");
-            dockerProc.WaitForExit();
+               private void CleanupDocker()
+               {
+                       var dockerComposeProc = 
Process.Start(@"docker-compose.exe", "-f " + Config.SniConfigPath + 
"/docker-compose.yml" + " stop");
+                       dockerComposeProc.WaitForExit();
 
-        }
+                       var dockerProc = Process.Start(@"docker.exe", "system 
prune -f");
+                       dockerProc.WaitForExit();
+               }
 
         private string RunDockerCommand(string dockerCommand)
         {
diff --git a/cppcache/acceptance-test/SNITest.cpp 
b/cppcache/acceptance-test/SNITest.cpp
index 46b9d1c..3475227 100644
--- a/cppcache/acceptance-test/SNITest.cpp
+++ b/cppcache/acceptance-test/SNITest.cpp
@@ -52,6 +52,8 @@ class SNITest : public ::testing::Test {
   ~SNITest() override = default;
 
   void SetUp() override {
+    TearDown();
+
     auto systemRVal = 0;
     std::string dockerComposeCmd = "docker-compose -f " +
                                    sniConfigPath.string() +
@@ -74,7 +76,9 @@ class SNITest : public ::testing::Test {
     }
   }
 
-  void TearDown() override {
+  void TearDown() override { cleanupDocker(); }
+
+  void cleanupDocker() {
     auto dockerComposeStopCommand = "docker-compose -f " +
                                     sniConfigPath.string() +
                                     "/docker-compose.yml" + " stop";

Reply via email to