You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2015/07/29 23:10:12 UTC
mesos git commit: Added a test for MasterInfo.
Repository: mesos
Updated Branches:
refs/heads/master 3d5196f35 -> 25a447add
Added a test for MasterInfo.
We want to test that when the master gets initialized, the
MasterInfo that it creates (and gets ultimately serialized to
ZooKeeper) has the correct information in its Address field.
Currently, the test hangs when run in after another
MasterZooKeeperTest, due to some issues around the recovery.
Jira: MESOS-2736
Review: https://reviews.apache.org/r/36807
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/25a447ad
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/25a447ad
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/25a447ad
Branch: refs/heads/master
Commit: 25a447add664c9cbdd4ee979cbf8a879c932cd20
Parents: 3d5196f
Author: Marco Massenzio <ma...@mesosphere.io>
Authored: Wed Jul 29 14:09:27 2015 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Jul 29 14:09:28 2015 -0700
----------------------------------------------------------------------
src/tests/master_tests.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/25a447ad/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 05c148e..6b5b045 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -2128,6 +2128,47 @@ TEST_F(MasterZooKeeperTest, LostZooKeeperCluster)
Shutdown();
}
+
+// This test verifies that the Address inside MasterInfo
+// is populated correctly, during master initialization.
+TEST_F(MasterZooKeeperTest, MasterInfoAddress)
+{
+ Try<PID<Master>> master_ = StartMaster();
+ ASSERT_SOME(master_);
+
+ auto master = master_.get();
+
+ ASSERT_SOME(StartSlave());
+
+ MockScheduler sched;
+ MesosSchedulerDriver driver(
+ &sched, DEFAULT_FRAMEWORK_INFO, master, DEFAULT_CREDENTIAL);
+
+ Future<MasterInfo> masterInfo;
+ EXPECT_CALL(sched, registered(&driver, _, _))
+ .WillOnce(FutureArg<2>(&masterInfo));
+
+ EXPECT_CALL(sched, resourceOffers(&driver, _))
+ .WillRepeatedly(Return()); // Ignore offers.
+
+ driver.start();
+ AWAIT_READY(masterInfo);
+
+ const Address& address = masterInfo.get().address();
+ EXPECT_EQ(stringify(master.address.ip), address.ip());
+ EXPECT_EQ(master.address.port, address.port());
+
+ // Protect from failures on those hosts where
+ // hostname cannot be resolved.
+ if (master.address.hostname().isSome()) {
+ ASSERT_EQ(master.address.hostname().get(), address.hostname());
+ }
+
+ driver.stop();
+ driver.join();
+ Shutdown();
+}
+
#endif // MESOS_HAS_JAVA