You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2019/01/12 00:35:33 UTC

[mesos] 09/09: Invoked base test `SetUp` and `TearDown` methods in derived tests.

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

jieyu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 6ba129e50f675eab74eb685b57b50326bc45699c
Author: Benjamin Bannier <be...@mesosphere.io>
AuthorDate: Sat Jan 12 00:26:46 2019 +0100

    Invoked base test `SetUp` and `TearDown` methods in derived tests.
    
    This patch adds required invocations of base class `Setup` and
    `TearDown` in more derived classes. Unfortunately googletest provides no
    indirection (e.g., via applying the template method pattern) and we do
    have to take care of this ourself.
    
    These missing cases were identified with the following clang query with
    `METHOD` either `"SetUp"` or `"TearDown"`
    
        match cxxMethodDecl(
            ofClass(isDerivedFrom("::testing::Test")),
            unless(isImplicit()),
            hasName(METHOD),
            isOverride(),
            unless(hasDescendant(cxxMemberCallExpr(
                hasDeclaration(cxxMethodDecl(hasName(METHOD), isVirtual()))))))
    
    and subsequentially fixing all true positives.
    
    Review: https://reviews.apache.org/r/69728/
    (cherry picked from commit cff4254907362eff27f12e1b512e248060a9b9d4)
---
 src/tests/containerizer/docker_tests.cpp | 4 ++++
 src/tests/csi_client_tests.cpp           | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/src/tests/containerizer/docker_tests.cpp b/src/tests/containerizer/docker_tests.cpp
index 0eefbd9..be826cf 100644
--- a/src/tests/containerizer/docker_tests.cpp
+++ b/src/tests/containerizer/docker_tests.cpp
@@ -74,6 +74,8 @@ class DockerTest : public MesosTest
 {
   void SetUp() override
   {
+    MesosTest::SetUp();
+
     Future<Nothing> pull = pullDockerImage(DOCKER_TEST_IMAGE);
 
     LOG_FIRST_N(WARNING, 1) << "Downloading " << string(DOCKER_TEST_IMAGE)
@@ -102,6 +104,8 @@ class DockerTest : public MesosTest
     foreach (const Docker::Container& container, containers.get()) {
       AWAIT_READY_FOR(docker.get()->rm(container.id, true), Seconds(30));
     }
+
+    MesosTest::TearDown();
   }
 
 protected:
diff --git a/src/tests/csi_client_tests.cpp b/src/tests/csi_client_tests.cpp
index 3d4a062..7751636 100644
--- a/src/tests/csi_client_tests.cpp
+++ b/src/tests/csi_client_tests.cpp
@@ -95,6 +95,8 @@ protected:
     AWAIT_ASSERT_READY(runtime.wait());
 
     ASSERT_SOME(plugin.shutdown());
+
+    TemporaryDirectoryTest::TearDown();
   }
 
   MockCSIPlugin plugin;