You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2016/02/17 16:32:32 UTC

mesos git commit: Fixed flakiness in ContainerLoggerTest.DefaultToSandbox.

Repository: mesos
Updated Branches:
  refs/heads/master ec5bdeab8 -> 250439f5b


Fixed flakiness in ContainerLoggerTest.DefaultToSandbox.

The test needs to wait for the task to finish before examining
the resulting files.

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


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

Branch: refs/heads/master
Commit: 250439f5b81127f9f7d69ed2d8ab5853ab9d6225
Parents: ec5bdea
Author: Joseph Wu <jo...@mesosphere.io>
Authored: Wed Feb 17 16:15:30 2016 +0100
Committer: Bernd Mathiske <be...@mesosphere.io>
Committed: Wed Feb 17 16:15:30 2016 +0100

----------------------------------------------------------------------
 src/tests/container_logger_tests.cpp | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/250439f5/src/tests/container_logger_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/container_logger_tests.cpp b/src/tests/container_logger_tests.cpp
index e161fd6..6e2b8c1 100644
--- a/src/tests/container_logger_tests.cpp
+++ b/src/tests/container_logger_tests.cpp
@@ -320,15 +320,25 @@ TEST_F(ContainerLoggerTest, DefaultToSandbox)
   // We'll start a task that outputs to stdout.
   TaskInfo task = createTask(offers.get()[0], "echo 'Hello World!'");
 
-  Future<TaskStatus> status;
+  Future<TaskStatus> statusRunning;
+  Future<TaskStatus> statusFinished;
   EXPECT_CALL(sched, statusUpdate(&driver, _))
-    .WillOnce(FutureArg<1>(&status))
+    .WillOnce(FutureArg<1>(&statusRunning))
+    .WillOnce(FutureArg<1>(&statusFinished))
     .WillRepeatedly(Return());       // Ignore subsequent updates.
 
   driver.launchTasks(offers.get()[0].id(), {task});
 
-  AWAIT_READY(status);
-  EXPECT_EQ(TASK_RUNNING, status.get().state());
+  AWAIT_READY(statusRunning);
+  EXPECT_EQ(TASK_RUNNING, statusRunning.get().state());
+
+  AWAIT_READY(statusFinished);
+  EXPECT_EQ(TASK_FINISHED, statusFinished.get().state());
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
 
   // Check that the sandbox was written to.
   string sandboxDirectory = path::join(
@@ -336,7 +346,7 @@ TEST_F(ContainerLoggerTest, DefaultToSandbox)
           flags.work_dir,
           slaveId,
           frameworkId.get(),
-          status->executor_id()),
+          statusRunning->executor_id()),
       "runs",
       "latest");
 
@@ -348,11 +358,6 @@ TEST_F(ContainerLoggerTest, DefaultToSandbox)
   Result<string> stdout = os::read(stdoutPath);
   ASSERT_SOME(stdout);
   EXPECT_TRUE(strings::contains(stdout.get(), "Hello World!"));
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
 }