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 2014/02/12 01:13:08 UTC

git commit: Fixed tests to properly set slave hostname when using whitelist.

Updated Branches:
  refs/heads/master 6e6be62a6 -> 7fc36c053


Fixed tests to properly set slave hostname when using whitelist.

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


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

Branch: refs/heads/master
Commit: 7fc36c053267d7d04f819273207ec9a0f873f872
Parents: 6e6be62
Author: Vinod Kone <vi...@twitter.com>
Authored: Tue Feb 11 15:14:43 2014 -0800
Committer: Vinod Kone <vi...@twitter.com>
Committed: Tue Feb 11 15:15:18 2014 -0800

----------------------------------------------------------------------
 src/tests/allocator_tests.cpp | 8 +++++---
 src/tests/master_tests.cpp    | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7fc36c05/src/tests/allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/allocator_tests.cpp b/src/tests/allocator_tests.cpp
index c9592d4..751a6c4 100644
--- a/src/tests/allocator_tests.cpp
+++ b/src/tests/allocator_tests.cpp
@@ -1561,10 +1561,14 @@ TYPED_TEST(AllocatorTest, WhitelistSlave)
   Try<PID<Master> > master = this->StartMaster(&this->allocator, masterFlags);
   ASSERT_SOME(master);
 
+  EXPECT_CALL(this->allocator, slaveAdded(_, _, _));
+
   slave::Flags flags = this->CreateSlaveFlags();
   flags.resources = Option<string>("cpus:2;mem:1024");
 
-  EXPECT_CALL(this->allocator, slaveAdded(_, _, _));
+  Try<string> hostname = os::hostname();
+  ASSERT_SOME(hostname);
+  flags.hostname = hostname.get();
 
   Try<PID<Slave> > slave = this->StartSlave(flags);
   ASSERT_SOME(slave);
@@ -1599,8 +1603,6 @@ TYPED_TEST(AllocatorTest, WhitelistSlave)
 
   // Update the whitelist to include the slave, so that
   // the allocator will start making allocations.
-  Try<string> hostname = os::hostname();
-  ASSERT_SOME(hostname);
   hosts = hostname.get() + "\n" + "dummy-slave";
 
   EXPECT_CALL(this->allocator, updateWhitelist(_));

http://git-wip-us.apache.org/repos/asf/mesos/blob/7fc36c05/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 70dab6f..9c14114 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -959,7 +959,9 @@ TEST_F(WhitelistTest, WhitelistSlave)
   Try<PID<Master> > master = StartMaster(flags);
   ASSERT_SOME(master);
 
-  Try<PID<Slave> > slave = StartSlave();
+  slave::Flags slaveFlags = CreateSlaveFlags();
+  slaveFlags.hostname = hostname.get();
+  Try<PID<Slave> > slave = StartSlave(slaveFlags);
   ASSERT_SOME(slave);
 
   MockScheduler sched;