You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2018/04/17 18:56:04 UTC
[4/5] mesos git commit: Added default executor test for agent
recovery without metadata.
Added default executor test for agent recovery without metadata.
Review: https://reviews.apache.org/r/66541
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bd447bb5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bd447bb5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bd447bb5
Branch: refs/heads/master
Commit: bd447bb5c0295b7cb9f5773b02d1e4cb52bd154e
Parents: eeaf505
Author: Gilbert Song <so...@gmail.com>
Authored: Sun Apr 8 20:01:20 2018 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Tue Apr 17 10:49:38 2018 -0700
----------------------------------------------------------------------
src/tests/default_executor_tests.cpp | 107 ++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/bd447bb5/src/tests/default_executor_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp
index 73a446c..bf849c4 100644
--- a/src/tests/default_executor_tests.cpp
+++ b/src/tests/default_executor_tests.cpp
@@ -1470,6 +1470,113 @@ TEST_P(DefaultExecutorTest, SlaveRecoveryWithMetadataCheckpointed)
}
+#ifdef __linux__
+// This test verifies that the agent could recover if the agent
+// metadata is not checkpointed. This is a regression test for
+// MESOS-8416.
+//
+// TODO(gilbert): For now, the test is linux specific because
+// the posix launcher is not able to destroy orphan containers
+// after recovery. Remove the `#ifdef __linux__` once MESOS-8771
+// is fixed.
+TEST_P(DefaultExecutorTest, ROOT_SlaveRecoveryWithoutMetadataCheckpointed)
+{
+ Try<Owned<cluster::Master>> master = StartMaster();
+ ASSERT_SOME(master);
+
+ slave::Flags flags = CreateSlaveFlags();
+ flags.launcher = "linux";
+
+ Owned<MasterDetector> detector = master.get()->createDetector();
+ Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags);
+ ASSERT_SOME(slave);
+
+ auto scheduler = std::make_shared<v1::MockHTTPScheduler>();
+
+ v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;
+ frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE);
+ frameworkInfo.set_checkpoint(false);
+
+ EXPECT_CALL(*scheduler, connected(_))
+ .WillOnce(v1::scheduler::SendSubscribe(frameworkInfo));
+
+ Future<v1::scheduler::Event::Subscribed> subscribed;
+ EXPECT_CALL(*scheduler, subscribed(_, _))
+ .WillOnce(FutureArg<1>(&subscribed));
+
+ Future<v1::scheduler::Event::Offers> offers;
+ EXPECT_CALL(*scheduler, offers(_, _))
+ .WillOnce(FutureArg<1>(&offers))
+ .WillRepeatedly(Return());
+
+ EXPECT_CALL(*scheduler, heartbeat(_))
+ .WillRepeatedly(Return()); // Ignore heartbeats.
+
+ v1::scheduler::TestMesos mesos(
+ master.get()->pid,
+ ContentType::PROTOBUF,
+ scheduler);
+
+ AWAIT_READY(subscribed);
+
+ v1::FrameworkID frameworkId(subscribed->framework_id());
+ v1::ExecutorInfo executorInfo = v1::createExecutorInfo(
+ v1::DEFAULT_EXECUTOR_ID,
+ None(),
+ "cpus:0.1;mem:32;disk:32",
+ v1::ExecutorInfo::DEFAULT,
+ frameworkId);
+
+ AWAIT_READY(offers);
+ ASSERT_FALSE(offers->offers().empty());
+
+ const v1::Offer& offer = offers->offers(0);
+ const v1::AgentID& agentId = offer.agent_id();
+
+ v1::TaskInfo taskInfo = v1::createTask(
+ agentId,
+ v1::Resources::parse("cpus:0.1;mem:32;disk:32").get(),
+ "sleep 1000");
+
+ v1::Offer::Operation launchGroup =
+ v1::LAUNCH_GROUP(executorInfo, v1::createTaskGroupInfo({taskInfo}));
+
+ Future<v1::scheduler::Event::Update> startingUpdate;
+ Future<v1::scheduler::Event::Update> runningUpdate;
+ EXPECT_CALL(*scheduler, update(_, _))
+ .WillOnce(DoAll(
+ FutureArg<1>(&startingUpdate),
+ v1::scheduler::SendAcknowledge(frameworkId, agentId)))
+ .WillOnce(DoAll(
+ FutureArg<1>(&runningUpdate),
+ v1::scheduler::SendAcknowledge(frameworkId, agentId)))
+ .WillRepeatedly(Return()); // Ignore subsequent status updates.
+
+ mesos.send(v1::createCallAccept(frameworkId, offer, {launchGroup}));
+
+ AWAIT_READY(startingUpdate);
+ ASSERT_EQ(v1::TASK_STARTING, startingUpdate->status().state());
+ ASSERT_EQ(taskInfo.task_id(), startingUpdate->status().task_id());
+
+ AWAIT_READY(runningUpdate);
+ ASSERT_EQ(v1::TASK_RUNNING, runningUpdate->status().state());
+ EXPECT_EQ(taskInfo.task_id(), runningUpdate->status().task_id());
+ EXPECT_TRUE(runningUpdate->status().has_timestamp());
+ ASSERT_TRUE(runningUpdate->status().has_container_status());
+
+ slave.get()->terminate();
+ slave->reset();
+
+ Future<Nothing> _recover = FUTURE_DISPATCH(_, &Slave::_recover);
+
+ slave = this->StartSlave(detector.get(), flags);
+ ASSERT_SOME(slave);
+
+ AWAIT_READY(_recover);
+}
+#endif // __linux__
+
+
// This is a regression test for MESOS-7926. It verifies that if
// the default executor process is killed, the future of the nested
// container destroy will be discarded and that discard will