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

[mesos] branch master updated: Fixed `LaunchNestedContainerSessionsInParallel` test.

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

alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 52be35f  Fixed `LaunchNestedContainerSessionsInParallel` test.
52be35f is described below

commit 52be35f47caea2712a0b13d7f963f7236533a2f1
Author: Andrei Budnik <ab...@mesosphere.com>
AuthorDate: Thu Sep 6 13:41:06 2018 +0200

    Fixed `LaunchNestedContainerSessionsInParallel` test.
    
    Previously, we sent `ATTACH_CONTAINER_OUTPUT` to attach to a
    short-living nested container. An attempt to attach to a terminated
    nested container leads to HTTP 500 error. This patch gets rid of
    `ATTACH_CONTAINER_OUTPUT` in favor of `LAUNCH_NESTED_CONTAINER_SESSION`
    so that we can read the container's output without using an extra call.
    
    Review: https://reviews.apache.org/r/68236/
---
 src/tests/api_tests.cpp | 65 ++++++++++++++++---------------------------------
 1 file changed, 21 insertions(+), 44 deletions(-)

diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 43541af..6be0dfa 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -6524,11 +6524,9 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
 // command executor. Each nested container prints a short message to the stdout
 // and then terminates. This test verifies that the output of each nested
 // container session contains the written message.
-//
-// TODO(abudnik): The test is flaky due to MESOS-8545 and hence disabled.
 TEST_P_TEMP_DISABLED_ON_WINDOWS(
     AgentAPITest,
-    DISABLED_ROOT_CGROUPS_LaunchNestedContainerSessionsInParallel)
+    ROOT_CGROUPS_LaunchNestedContainerSessionsInParallel)
 {
   const int numContainers = 10;
 
@@ -6598,56 +6596,35 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(
   for (int i = 0; i < numContainers; i++) {
     containerId.set_value(id::UUID::random().toString());
 
-    {
-      v1::agent::Call call;
-      call.set_type(v1::agent::Call::LAUNCH_NESTED_CONTAINER_SESSION);
-
-      call.mutable_launch_nested_container_session()->mutable_container_id()
-        ->CopyFrom(containerId);
-
-      call.mutable_launch_nested_container_session()->mutable_command()
-        ->CopyFrom(v1::createCommandInfo("echo echo"));
-
-      http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
-      headers["Accept"] = stringify(ContentType::RECORDIO);
-      headers[MESSAGE_ACCEPT] = stringify(messageContentType);
-
-      auto response = http::streaming::post(
-          slave.get()->pid,
-          "api/v1",
-          headers,
-          serialize(messageContentType, call),
-          stringify(messageContentType));
-
-      AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
-    }
+    v1::agent::Call call;
+    call.set_type(v1::agent::Call::LAUNCH_NESTED_CONTAINER_SESSION);
 
-    {
-      v1::agent::Call call;
-      call.set_type(v1::agent::Call::ATTACH_CONTAINER_OUTPUT);
+    call.mutable_launch_nested_container_session()->mutable_container_id()
+      ->CopyFrom(containerId);
 
-      call.mutable_attach_container_output()->mutable_container_id()
-        ->CopyFrom(containerId);
+    call.mutable_launch_nested_container_session()->mutable_command()
+      ->CopyFrom(v1::createCommandInfo("echo echo"));
 
-      http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
-      headers["Accept"] = stringify(messageContentType);
+    http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
+    headers["Accept"] = stringify(ContentType::RECORDIO);
+    headers[MESSAGE_ACCEPT] = stringify(messageContentType);
 
-      auto response = http::streaming::post(
-          slave.get()->pid,
-          "api/v1",
-          headers,
-          serialize(messageContentType, call),
-          stringify(messageContentType));
+    auto response = http::streaming::post(
+        slave.get()->pid,
+        "api/v1",
+        headers,
+        serialize(messageContentType, call),
+        stringify(messageContentType));
 
-      AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
-      ASSERT_SOME(response->reader);
+    ASSERT_SOME(response->reader);
 
-      outputs.emplace_back(response->reader.get());
-    }
+    Option<http::Pipe::Reader> output = response->reader.get();
+    ASSERT_SOME(output);
+    outputs.emplace_back(std::move(output));
   }
 
   foreach (Option<http::Pipe::Reader>& output, outputs) {
-    // Read the output from the ATTACH_CONTAINER_OUTPUT.
+    // Read the output from the LAUNCH_NESTED_CONTAINER_SESSION.
     ASSERT_SOME(output);
 
     Future<tuple<string, string>> received =