This test verifies that attaching to the input of a container fails if the containerizer doesn't support the operation.
| 8146 | // This test verifies that attaching to the input of a container fails if the |
| 8147 | // containerizer doesn't support the operation. |
| 8148 | TEST_F(AgentAPITest, AttachContainerInputFailure) |
| 8149 | { |
| 8150 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 8151 | ASSERT_SOME(master); |
| 8152 | |
| 8153 | slave::Flags flags = CreateSlaveFlags(); |
| 8154 | |
| 8155 | // Disable authorization in the agent. |
| 8156 | flags.acls = None(); |
| 8157 | |
| 8158 | MockExecutor exec(DEFAULT_EXECUTOR_ID); |
| 8159 | TestContainerizer containerizer(&exec); |
| 8160 | |
| 8161 | Owned<MasterDetector> detector = master.get()->createDetector(); |
| 8162 | |
| 8163 | Try<Owned<cluster::Slave>> slave = |
| 8164 | StartSlave(detector.get(), &containerizer, flags); |
| 8165 | |
| 8166 | ASSERT_SOME(slave); |
| 8167 | |
| 8168 | MockScheduler sched; |
| 8169 | MesosSchedulerDriver driver( |
| 8170 | &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL); |
| 8171 | |
| 8172 | EXPECT_CALL(sched, registered(&driver, _, _)); |
| 8173 | |
| 8174 | Future<vector<Offer>> offers; |
| 8175 | EXPECT_CALL(sched, resourceOffers(_, _)) |
| 8176 | .WillOnce(FutureArg<1>(&offers)); |
| 8177 | |
| 8178 | driver.start(); |
| 8179 | |
| 8180 | AWAIT_READY(offers); |
| 8181 | ASSERT_FALSE(offers->empty()); |
| 8182 | |
| 8183 | EXPECT_CALL(exec, registered(_, _, _, _)); |
| 8184 | |
| 8185 | EXPECT_CALL(exec, launchTask(_, _)) |
| 8186 | .WillOnce(SendStatusUpdateFromTask(TASK_RUNNING)); |
| 8187 | |
| 8188 | Future<TaskStatus> status; |
| 8189 | EXPECT_CALL(sched, statusUpdate(_, _)) |
| 8190 | .WillOnce(FutureArg<1>(&status)); |
| 8191 | |
| 8192 | TaskInfo task = createTask(offers.get()[0], "", DEFAULT_EXECUTOR_ID); |
| 8193 | |
| 8194 | driver.launchTasks(offers.get()[0].id(), {task}); |
| 8195 | |
| 8196 | AWAIT_READY(status); |
| 8197 | ASSERT_EQ(TASK_RUNNING, status->state()); |
| 8198 | |
| 8199 | Future<hashset<ContainerID>> containerIds = containerizer.containers(); |
| 8200 | AWAIT_READY(containerIds); |
| 8201 | ASSERT_EQ(1u, containerIds->size()); |
| 8202 | |
| 8203 | v1::agent::Call call; |
| 8204 | call.set_type(v1::agent::Call::ATTACH_CONTAINER_INPUT); |
| 8205 |
nothing calls this directly
no test coverage detected