| 205 | |
| 206 | |
| 207 | TEST_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()); |
nothing calls this directly
no test coverage detected