| 99 | |
| 100 | |
| 101 | TEST_F(MasterContenderDetectorTest, File) |
| 102 | { |
| 103 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 104 | ASSERT_SOME(master); |
| 105 | |
| 106 | // Write "master" to a file and use the "file://" mechanism to |
| 107 | // create a master detector for the slave. Still requires a master |
| 108 | // detector for the master first. |
| 109 | slave::Flags flags = CreateSlaveFlags(); |
| 110 | |
| 111 | const string& path = path::join(flags.work_dir, "master"); |
| 112 | ASSERT_SOME(os::write(path, stringify(master.get()->pid))); |
| 113 | |
| 114 | Try<MasterDetector*> _detector = MasterDetector::create(uri::from_path(path)); |
| 115 | |
| 116 | ASSERT_SOME(_detector); |
| 117 | |
| 118 | Owned<MasterDetector> detector(_detector.get()); |
| 119 | |
| 120 | Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags); |
| 121 | ASSERT_SOME(slave); |
| 122 | |
| 123 | MockScheduler sched; |
| 124 | MesosSchedulerDriver driver( |
| 125 | &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL); |
| 126 | |
| 127 | EXPECT_CALL(sched, registered(&driver, _, _)); |
| 128 | |
| 129 | Future<vector<Offer>> offers; |
| 130 | EXPECT_CALL(sched, resourceOffers(&driver, _)) |
| 131 | .WillOnce(FutureArg<1>(&offers)); |
| 132 | |
| 133 | driver.start(); |
| 134 | |
| 135 | AWAIT_READY(offers); |
| 136 | |
| 137 | driver.stop(); |
| 138 | driver.join(); |
| 139 | } |
| 140 | |
| 141 | |
| 142 | TEST(BasicMasterContenderDetectorTest, Contender) |
nothing calls this directly
no test coverage detected