You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/06/09 14:44:28 UTC

[5/5] mesos git commit: Parameterized partition tests with registry "strictness".

Parameterized partition tests with registry "strictness".

We should test that the same partition behavior is implemented
for both strict and non-strict registry configurations. A few
of the partition tests don't depend on registry strictness,
so move them to a separate test class to avoid needlessly
running them twice.

Review: https://reviews.apache.org/r/48344/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7036548b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7036548b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7036548b

Branch: refs/heads/master
Commit: 7036548b9e5d25e32f1a3c573208aea7cdd0e464
Parents: 623609b
Author: Neil Conway <ne...@gmail.com>
Authored: Thu Jun 9 10:44:07 2016 -0400
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Jun 9 10:44:49 2016 -0400

----------------------------------------------------------------------
 src/tests/partition_tests.cpp | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7036548b/src/tests/partition_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/partition_tests.cpp b/src/tests/partition_tests.cpp
index a25c102..91969e4 100644
--- a/src/tests/partition_tests.cpp
+++ b/src/tests/partition_tests.cpp
@@ -65,19 +65,28 @@ using testing::AtMost;
 using testing::Eq;
 using testing::Return;
 
+using ::testing::WithParamInterface;
+
 namespace mesos {
 namespace internal {
 namespace tests {
 
 
-class PartitionTest : public MesosTest {};
+class PartitionTest : public MesosTest,
+                      public WithParamInterface<bool> {};
+
+
+// The Registrar tests are parameterized by "strictness".
+INSTANTIATE_TEST_CASE_P(Strict, PartitionTest, ::testing::Bool());
 
 
 // This test checks that a scheduler gets a slave lost
 // message for a partitioned slave.
-TEST_F(PartitionTest, PartitionedSlave)
+TEST_P(PartitionTest, PartitionedSlave)
 {
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry_strict = GetParam();
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -158,9 +167,11 @@ TEST_F(PartitionTest, PartitionedSlave)
 // re-register with its running tasks. We've already notified
 // frameworks that these tasks were LOST, so we have to have the
 // slave shut down.
-TEST_F(PartitionTest, PartitionedSlaveReregistration)
+TEST_P(PartitionTest, PartitionedSlaveReregistration)
 {
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry_strict = GetParam();
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -313,9 +324,11 @@ TEST_F(PartitionTest, PartitionedSlaveReregistration)
 // the slave may attempt to send updates if it was unaware that the
 // master removed it. We've already notified frameworks that these
 // tasks were LOST, so we have to have the slave shut down.
-TEST_F(PartitionTest, PartitionedSlaveStatusUpdates)
+TEST_P(PartitionTest, PartitionedSlaveStatusUpdates)
 {
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry_strict = GetParam();
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -437,9 +450,11 @@ TEST_F(PartitionTest, PartitionedSlaveStatusUpdates)
 // it was unaware that the master removed it. We've already
 // notified frameworks that the tasks under the executors were LOST,
 // so we have to have the slave shut down.
-TEST_F(PartitionTest, PartitionedSlaveExitedExecutor)
+TEST_P(PartitionTest, PartitionedSlaveExitedExecutor)
 {
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry_strict = GetParam();
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -568,10 +583,13 @@ TEST_F(PartitionTest, PartitionedSlaveExitedExecutor)
 }
 
 
+class OneWayPartitionTest : public MesosTest {};
+
+
 // This test verifies that if master --> slave socket closes and the
 // slave is not aware of it (i.e., one way network partition), slave
 // will re-register with the master.
-TEST_F(PartitionTest, OneWayPartitionMasterToSlave)
+TEST_F(OneWayPartitionTest, MasterToSlave)
 {
   // Start a master.
   master::Flags masterFlags = CreateMasterFlags();
@@ -623,7 +641,7 @@ TEST_F(PartitionTest, OneWayPartitionMasterToSlave)
 // framework is not aware of it (i.e., one way network partition), all
 // subsequent calls from the framework after the master has marked it as
 // disconnected would result in an error message causing the framework to abort.
-TEST_F(PartitionTest, OneWayPartitionMasterToScheduler)
+TEST_F(OneWayPartitionTest, MasterToScheduler)
 {
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);