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

Function TEST_P

src/tests/containerizer/nested_mesos_containerizer_tests.cpp:207–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205
206
207TEST_P(NestedMesosContainerizerTest, ROOT_CGROUPS_LaunchNested)
208{
209 slave::Flags flags = CreateSlaveFlags();
210 flags.launcher = "linux";
211 flags.isolation = "cgroups/cpu,filesystem/linux,namespaces/pid";
212
213 Fetcher fetcher(flags);
214
215 Try<MesosContainerizer*> create = MesosContainerizer::create(
216 flags,
217 false,
218 &fetcher);
219
220 ASSERT_SOME(create);
221
222 Owned<MesosContainerizer> containerizer(create.get());
223
224 SlaveState state;
225 state.id = SlaveID();
226
227 AWAIT_READY(containerizer->recover(state));
228
229 ContainerID containerId;
230 containerId.set_value(id::UUID::random().toString());
231
232 Try<string> directory = environment->mkdtemp();
233 ASSERT_SOME(directory);
234
235 Future<Containerizer::LaunchResult> launch = containerizer->launch(
236 containerId,
237 createContainerConfig(
238 None(),
239 createExecutorInfo("executor", "sleep 1000", "cpus:1"),
240 directory.get()),
241 map<string, string>(),
242 None());
243
244 AWAIT_ASSERT_EQ(Containerizer::LaunchResult::SUCCESS, launch);
245
246 // Now launch nested container.
247 ContainerID nestedContainerId;
248 nestedContainerId.mutable_parent()->CopyFrom(containerId);
249 nestedContainerId.set_value(id::UUID::random().toString());
250
251 launch = containerizer->launch(
252 nestedContainerId,
253 createNestedContainerConfig("cpus:0.1", createCommandInfo("exit 42")),
254 map<string, string>(),
255 None());
256
257 AWAIT_ASSERT_EQ(Containerizer::LaunchResult::SUCCESS, launch);
258
259 Future<Option<ContainerTermination>> wait = containerizer->wait(
260 nestedContainerId);
261
262 AWAIT_READY(wait);
263 ASSERT_SOME(wait.get());
264 ASSERT_TRUE(wait.get()->has_status());

Callers

nothing calls this directly

Calls 15

randomFunction · 0.85
createContainerConfigFunction · 0.85
NoneClass · 0.85
createExecutorInfoFunction · 0.85
createCommandInfoFunction · 0.85
getCgroupPathFunction · 0.85
getForkedPidPathFunction · 0.85
getMetaRootDirFunction · 0.85
getContainerConfigFunction · 0.85
getRuntimePathFunction · 0.85
mkdtempMethod · 0.80
CopyFromMethod · 0.80

Tested by

no test coverage detected