[4/5] mesos git commit: Fixed two slave recovery tests.

2018-02-12 Thread bmahler
Fixed two slave recovery tests.

These two tests are affected by the lingering executor fix
(#65109). We should wait to make sure tasks are actually launched
on the executor before trigger the agent failover. Otherwise, the
container will be shutdown upon re-registration because the executor
has never received any task.

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


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

Branch: refs/heads/1.4.x
Commit: 8ce535714bd355c202c22d820ef261509f692dd7
Parents: 9c14850
Author: Meng Zhu 
Authored: Thu Feb 8 17:19:48 2018 -0800
Committer: Benjamin Mahler 
Committed: Mon Feb 12 21:48:52 2018 -0800

--
 src/tests/slave_recovery_tests.cpp | 22 ++
 1 file changed, 22 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/mesos/blob/8ce53571/src/tests/slave_recovery_tests.cpp
--
diff --git a/src/tests/slave_recovery_tests.cpp 
b/src/tests/slave_recovery_tests.cpp
index 6207a50..ca16401 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -4528,7 +4528,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -4560,6 +4564,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();
 
@@ -4632,7 +4643,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -4664,6 +4679,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();
 



[4/5] mesos git commit: Fixed two slave recovery tests.

2018-02-12 Thread bmahler
Fixed two slave recovery tests.

These two tests are affected by the lingering executor fix
(#65109). We should wait to make sure tasks are actually launched
on the executor before trigger the agent failover. Otherwise, the
container will be shutdown upon re-registration because the executor
has never received any task.

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


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

Branch: refs/heads/1.3.x
Commit: 320efb5aa24113b6056adfc1fd2ceb496e179038
Parents: d85fb56
Author: Meng Zhu 
Authored: Thu Feb 8 17:19:48 2018 -0800
Committer: Benjamin Mahler 
Committed: Mon Feb 12 15:24:24 2018 -0800

--
 src/tests/slave_recovery_tests.cpp | 22 ++
 1 file changed, 22 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/mesos/blob/320efb5a/src/tests/slave_recovery_tests.cpp
--
diff --git a/src/tests/slave_recovery_tests.cpp 
b/src/tests/slave_recovery_tests.cpp
index 4f5a6a2..331c129 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -4145,7 +4145,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -4177,6 +4181,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();
 
@@ -4249,7 +4260,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -4281,6 +4296,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();
 



mesos git commit: Fixed two slave recovery tests.

2018-02-08 Thread vinodkone
Repository: mesos
Updated Branches:
  refs/heads/master a018cf33d -> 97d505e5c


Fixed two slave recovery tests.

These two tests are affected by the lingering executor fix
(#65109). We should wait to make sure tasks are actually launched
on the executor before trigger the agent failover. Otherwise, the
container will be shutdown upon re-registration because the executor
has never received any task.

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


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

Branch: refs/heads/master
Commit: 97d505e5cc27a11b7538cc81fa57d9e4fd10aaf9
Parents: a018cf3
Author: Meng Zhu 
Authored: Thu Feb 8 17:19:48 2018 -0800
Committer: Vinod Kone 
Committed: Thu Feb 8 17:19:48 2018 -0800

--
 src/tests/slave_recovery_tests.cpp | 22 ++
 1 file changed, 22 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/mesos/blob/97d505e5/src/tests/slave_recovery_tests.cpp
--
diff --git a/src/tests/slave_recovery_tests.cpp 
b/src/tests/slave_recovery_tests.cpp
index 77aa60c..10f8dd3 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -5156,7 +5156,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -5188,6 +5192,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceForward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();
 
@@ -5260,7 +5271,11 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
   // Scheduler expectations.
   EXPECT_CALL(sched, registered(_, _, _));
 
+  Future statusStarting;
+  Future statusRunning;
   EXPECT_CALL(sched, statusUpdate(_, _))
+.WillOnce(FutureArg<1>())
+.WillOnce(FutureArg<1>())
 .WillRepeatedly(Return());
 
   Future offers1;
@@ -5292,6 +5307,13 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, 
CGROUPS_ROOT_PidNamespaceBackward)
 
   ContainerID containerId = *(containers->begin());
 
+  // Wait until task is running.
+  AWAIT_READY(statusStarting);
+  EXPECT_EQ(TASK_STARTING, statusStarting->state());
+
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning->state());
+
   // Stop the slave.
   slave.get()->terminate();