Removed "strictness" parameter from RegistrarTest and PartitionTest.

This parameter should no longer result in any difference in behavior.

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


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

Branch: refs/heads/master
Commit: 6280299bf78f42929daecd271cbdad4e6ce24f62
Parents: 89a78b8
Author: Neil Conway <neil.con...@gmail.com>
Authored: Mon Sep 19 15:49:34 2016 -0700
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Mon Sep 19 15:49:34 2016 -0700

----------------------------------------------------------------------
 src/tests/partition_tests.cpp | 55 ++++++++++----------------------------
 src/tests/registrar_tests.cpp | 49 +++++++++++++--------------------
 2 files changed, 32 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6280299b/src/tests/partition_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/partition_tests.cpp b/src/tests/partition_tests.cpp
index 895a073..7c38f0e 100644
--- a/src/tests/partition_tests.cpp
+++ b/src/tests/partition_tests.cpp
@@ -79,21 +79,14 @@ namespace internal {
 namespace tests {
 
 
-class PartitionTest : public MesosTest,
-                      public WithParamInterface<bool> {};
-
-
-// The Registrar tests are parameterized by "strictness".
-INSTANTIATE_TEST_CASE_P(Strict, PartitionTest, ::testing::Bool());
+class PartitionTest : public MesosTest {};
 
 
 // This test checks that a scheduler gets a slave lost
 // message for a partitioned slave.
-TEST_P(PartitionTest, PartitionedSlave)
+TEST_F(PartitionTest, PartitionedSlave)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -171,13 +164,11 @@ TEST_P(PartitionTest, PartitionedSlave)
 // This test checks that a slave can reregister with the master after
 // a partition, and that PARTITION_AWARE tasks running on the slave
 // continue to run.
-TEST_P(PartitionTest, ReregisterSlavePartitionAware)
+TEST_F(PartitionTest, ReregisterSlavePartitionAware)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -317,13 +308,11 @@ TEST_P(PartitionTest, ReregisterSlavePartitionAware)
 // This test checks that a slave can reregister with the master after
 // a partition, and that non-PARTITION_AWARE tasks running on the
 // slave are shutdown.
-TEST_P(PartitionTest, ReregisterSlaveNotPartitionAware)
+TEST_F(PartitionTest, ReregisterSlaveNotPartitionAware)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -480,13 +469,11 @@ TEST_P(PartitionTest, ReregisterSlaveNotPartitionAware)
 // not. Both tasks should survive the reregistration of the partitioned
 // agent: we allow the non-partition-aware task to continue running for
 // backward compatibility with the "non-strict" Mesos 1.0 behavior.
-TEST_P(PartitionTest, PartitionedSlaveReregistrationMasterFailover)
+TEST_F(PartitionTest, PartitionedSlaveReregistrationMasterFailover)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -733,13 +720,11 @@ TEST_P(PartitionTest, 
PartitionedSlaveReregistrationMasterFailover)
 // a task for a PARTITION_AWARE scheduler. The scheduler disconnects
 // before the partition heals. Right now, the task is left running as
 // an orphan; once MESOS-4659 is fixed, the task should be shutdown.
-TEST_P(PartitionTest, PartitionedSlaveOrphanedTask)
+TEST_F(PartitionTest, PartitionedSlaveOrphanedTask)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -903,13 +888,11 @@ TEST_P(PartitionTest, PartitionedSlaveOrphanedTask)
 // master (e.g., because of a spurious Zk leader flag at the slave),
 // the master does not kill any tasks on the slave, even if those
 // tasks are not PARTITION_AWARE.
-TEST_P(PartitionTest, SpuriousSlaveReregistration)
+TEST_F(PartitionTest, SpuriousSlaveReregistration)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -1006,13 +989,11 @@ TEST_P(PartitionTest, SpuriousSlaveReregistration)
 // master's POV). In prior Mesos versions, the master would shutdown
 // the slave in this situation. In Mesos >= 1.1, the master will drop
 // the status update; the slave will eventually try to reregister.
-TEST_P(PartitionTest, PartitionedSlaveStatusUpdates)
+TEST_F(PartitionTest, PartitionedSlaveStatusUpdates)
 {
   Clock::pause();
 
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -1160,11 +1141,9 @@ TEST_P(PartitionTest, PartitionedSlaveStatusUpdates)
 // versions, the master would shutdown the slave in this situation. In
 // Mesos >= 1.1, the master will drop the message; the slave will
 // eventually try to reregister.
-TEST_P(PartitionTest, PartitionedSlaveExitedExecutor)
+TEST_F(PartitionTest, PartitionedSlaveExitedExecutor)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -1282,12 +1261,11 @@ TEST_P(PartitionTest, PartitionedSlaveExitedExecutor)
 // This test checks that the master correctly garbage collects
 // information about unreachable agents from the registry using the
 // count-based GC criterion.
-TEST_P(PartitionTest, RegistryGcByCount)
+TEST_F(PartitionTest, RegistryGcByCount)
 {
   // Configure GC to only keep the most recent partitioned agent in
   // the unreachable list.
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
   masterFlags.registry_max_agent_count = 1;
 
   // Test logic assumes that two agents can be marked unreachable in
@@ -1510,12 +1488,11 @@ TEST_P(PartitionTest, RegistryGcByCount)
 // would be annoying to do by creating slaves and simulating network
 // partitions; instead we add agents to the unreachable list by
 // directly applying registry operations.
-TEST_P(PartitionTest, RegistryGcByCountManySlaves)
+TEST_F(PartitionTest, RegistryGcByCountManySlaves)
 {
   // Configure GC to only keep the most recent partitioned agent in
   // the unreachable list.
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
   masterFlags.registry_max_agent_count = 1;
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
@@ -1632,12 +1609,11 @@ TEST_P(PartitionTest, RegistryGcByCountManySlaves)
 // 900 secs (15 mins):  GC runs, nothing discarded
 // 1800 secs (30 mins): GC runs, slave1 is discarded
 // 2700 secs (45 mins): GC runs, slave2 is discarded
-TEST_P(PartitionTest, RegistryGcByAge)
+TEST_F(PartitionTest, RegistryGcByAge)
 {
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.registry_gc_interval = Minutes(15);
   masterFlags.registry_max_agent_age = Minutes(20);
-  masterFlags.registry_strict = GetParam();
 
   // Pause the clock before starting the master. This ensures that we
   // know precisely when the GC timer will fire.
@@ -1888,10 +1864,9 @@ TEST_P(PartitionTest, RegistryGcByAge)
 // configure GC to only keep a single agent. Concurrently with GC
 // running, we arrange for one of those agents to reregister with the
 // master.
-TEST_P(PartitionTest, RegistryGcRace2)
+TEST_F(PartitionTest, RegistryGcRace2)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
   masterFlags.registry_max_agent_count = 1;
 
   Clock::pause();
@@ -2165,11 +2140,9 @@ TEST_P(PartitionTest, RegistryGcRace2)
 // health checks twice. At present, this can only occur if the registry
 // operation to mark the slave unreachable takes so long that the
 // slave fails an additional health check in the mean time.
-TEST_P(PartitionTest, FailHealthChecksTwice)
+TEST_F(PartitionTest, FailHealthChecksTwice)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  masterFlags.registry_strict = GetParam();
-
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/6280299b/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index 6c42fd1..0433b26 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -212,23 +212,10 @@ protected:
 };
 
 
-class RegistrarTest : public RegistrarTestBase,
-                      public WithParamInterface<bool>
-{
-protected:
-  virtual void SetUp()
-  {
-    RegistrarTestBase::SetUp();
-    flags.registry_strict = GetParam();
-  }
-};
-
-
-// The Registrar tests are parameterized by "strictness".
-INSTANTIATE_TEST_CASE_P(Strict, RegistrarTest, ::testing::Bool());
+class RegistrarTest : public RegistrarTestBase {};
 
 
-TEST_P(RegistrarTest, Recover)
+TEST_F(RegistrarTest, Recover)
 {
   Registrar registrar(flags, state);
 
@@ -268,7 +255,7 @@ TEST_P(RegistrarTest, Recover)
 }
 
 
-TEST_P(RegistrarTest, Admit)
+TEST_F(RegistrarTest, Admit)
 {
   Registrar registrar(flags, state);
   AWAIT_READY(registrar.recover(master));
@@ -278,7 +265,7 @@ TEST_P(RegistrarTest, Admit)
 }
 
 
-TEST_P(RegistrarTest, MarkReachable)
+TEST_F(RegistrarTest, MarkReachable)
 {
   Registrar registrar(flags, state);
   AWAIT_READY(registrar.recover(master));
@@ -310,7 +297,7 @@ TEST_P(RegistrarTest, MarkReachable)
 }
 
 
-TEST_P(RegistrarTest, MarkUnreachable)
+TEST_F(RegistrarTest, MarkUnreachable)
 {
   Registrar registrar(flags, state);
   AWAIT_READY(registrar.recover(master));
@@ -353,7 +340,7 @@ TEST_P(RegistrarTest, MarkUnreachable)
 }
 
 
-TEST_P(RegistrarTest, PruneUnreachable)
+TEST_F(RegistrarTest, PruneUnreachable)
 {
   Registrar registrar(flags, state);
   AWAIT_READY(registrar.recover(master));
@@ -399,7 +386,7 @@ TEST_P(RegistrarTest, PruneUnreachable)
 }
 
 
-TEST_P(RegistrarTest, Remove)
+TEST_F(RegistrarTest, Remove)
 {
   Registrar registrar(flags, state);
   AWAIT_READY(registrar.recover(master));
@@ -460,7 +447,7 @@ TEST_P(RegistrarTest, Remove)
 
 // Adds maintenance schedules to the registry, one machine at a time.
 // Then removes machines from the schedule.
-TEST_P(RegistrarTest, UpdateMaintenanceSchedule)
+TEST_F(RegistrarTest, UpdateMaintenanceSchedule)
 {
   // Machine definitions used in this test.
   MachineID machine1;
@@ -619,7 +606,7 @@ TEST_P(RegistrarTest, UpdateMaintenanceSchedule)
 
 
 // Creates a schedule and properly starts maintenance.
-TEST_P(RegistrarTest, StartMaintenance)
+TEST_F(RegistrarTest, StartMaintenance)
 {
   // Machine definitions used in this test.
   MachineID machine1;
@@ -706,7 +693,7 @@ TEST_P(RegistrarTest, StartMaintenance)
 
 
 // Creates a schedule and properly starts and stops maintenance.
-TEST_P(RegistrarTest, StopMaintenance)
+TEST_F(RegistrarTest, StopMaintenance)
 {
   // Machine definitions used in this test.
   MachineID machine1;
@@ -788,7 +775,7 @@ TEST_P(RegistrarTest, StopMaintenance)
 
 
 // Tests that adding and updating quotas in the registry works properly.
-TEST_P(RegistrarTest, UpdateQuota)
+TEST_F(RegistrarTest, UpdateQuota)
 {
   const string ROLE1 = "role1";
   const string ROLE2 = "role2";
@@ -915,7 +902,7 @@ TEST_P(RegistrarTest, UpdateQuota)
 
 
 // Tests removing quotas from the registry.
-TEST_P(RegistrarTest, RemoveQuota)
+TEST_F(RegistrarTest, RemoveQuota)
 {
   const string ROLE1 = "role1";
   const string ROLE2 = "role2";
@@ -993,7 +980,7 @@ TEST_P(RegistrarTest, RemoveQuota)
 
 
 // Tests that updating weights in the registry works properly.
-TEST_P(RegistrarTest, UpdateWeights)
+TEST_F(RegistrarTest, UpdateWeights)
 {
   const string ROLE1 = "role1";
   double WEIGHT1 = 2.0;
@@ -1056,7 +1043,7 @@ TEST_P(RegistrarTest, UpdateWeights)
 }
 
 
-TEST_P(RegistrarTest, Bootstrap)
+TEST_F(RegistrarTest, Bootstrap)
 {
   // Run 1 simulates the reregistration of a slave that is not present
   // in the registry.
@@ -1092,7 +1079,7 @@ public:
 };
 
 
-TEST_P(RegistrarTest, FetchTimeout)
+TEST_F(RegistrarTest, FetchTimeout)
 {
   Clock::pause();
 
@@ -1121,7 +1108,7 @@ TEST_P(RegistrarTest, FetchTimeout)
 }
 
 
-TEST_P(RegistrarTest, StoreTimeout)
+TEST_F(RegistrarTest, StoreTimeout)
 {
   Clock::pause();
 
@@ -1153,7 +1140,7 @@ TEST_P(RegistrarTest, StoreTimeout)
 }
 
 
-TEST_P(RegistrarTest, Abort)
+TEST_F(RegistrarTest, Abort)
 {
   MockStorage storage;
   State state(&storage);
@@ -1180,7 +1167,7 @@ TEST_P(RegistrarTest, Abort)
 
 // Tests that requests to the '/registry' endpoint are authenticated when HTTP
 // authentication is enabled.
-TEST_P(RegistrarTest, Authentication)
+TEST_F(RegistrarTest, Authentication)
 {
   const string AUTHENTICATION_REALM = "realm";
 

Reply via email to