MCPcopy Create free account
hub / github.com/apache/mesos / foreach

Function foreach

src/tests/slave_tests.cpp:9797–9935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9795 const size_t maxExecutorsPerFrameworkArray[] = {0, 1, 2};
9796
9797 foreach (const size_t maxExecutorsPerFramework,
9798 maxExecutorsPerFrameworkArray) {
9799 master::Flags masterFlags = MesosTest::CreateMasterFlags();
9800 Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
9801 ASSERT_SOME(master);
9802
9803 hashmap<ExecutorID, Executor*> executorMap;
9804 vector<Owned<MockExecutor>> executors;
9805
9806 vector<ExecutorInfo> executorInfos;
9807
9808 for (size_t i = 0; i < totalExecutorsPerFramework; i++) {
9809 ExecutorInfo executorInfo = createExecutorInfo(stringify(i), "exit 1");
9810
9811 executorInfos.push_back(executorInfo);
9812
9813 Owned<MockExecutor> executor =
9814 Owned<MockExecutor>(new MockExecutor(executorInfo.executor_id()));
9815
9816 executorMap.put(executorInfo.executor_id(), executor.get());
9817 executors.push_back(executor);
9818 }
9819
9820 TestContainerizer containerizer(executorMap);
9821
9822 slave::Flags agentFlags = CreateSlaveFlags();
9823 agentFlags.max_completed_executors_per_framework = maxExecutorsPerFramework;
9824
9825 Owned<MasterDetector> detector = master.get()->createDetector();
9826 Try<Owned<cluster::Slave>> agent =
9827 StartSlave(detector.get(), &containerizer, agentFlags);
9828
9829 ASSERT_SOME(agent);
9830
9831 MockScheduler sched;
9832 MesosSchedulerDriver driver(
9833 &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL);
9834
9835 Future<Nothing> schedRegistered;
9836 EXPECT_CALL(sched, registered(_, _, _))
9837 .WillOnce(FutureSatisfy(&schedRegistered));
9838
9839 process::Queue<Offer> offers;
9840 EXPECT_CALL(sched, resourceOffers(_, _))
9841 .WillRepeatedly(EnqueueOffers(&offers));
9842
9843 driver.start();
9844
9845 AWAIT_READY(schedRegistered);
9846
9847 for (size_t i = 0; i < totalExecutorsPerFramework; i++) {
9848 // Advance the clock to trigger both agent registration and a
9849 // batch allocation.
9850 Clock::advance(agentFlags.registration_backoff_factor);
9851 Clock::advance(masterFlags.allocation_interval);
9852
9853 Future<Offer> offer = offers.get();
9854 AWAIT_READY(offer);

Callers

nothing calls this directly

Calls 15

createExecutorInfoFunction · 0.85
FutureSatisfyFunction · 0.85
shutdownFunction · 0.85
NoneClass · 0.85
createBasicAuthHeadersFunction · 0.85
OKClass · 0.85
createDetectorMethod · 0.80
MergeFromMethod · 0.80
typeMethod · 0.80
CopyFromMethod · 0.80
startMethod · 0.65
launchTasksMethod · 0.65

Tested by

no test coverage detected