This test verifies that operation status updates are resent to the master until they are acknowledged. To accomplish this: 1. Reserves agent default resources. 2. Expects the framework to receive an operation status update. 3. Advances the clock and verifies that the agent resends the operation status update. 4. Makes the framework acknowledge the operation status update. 5. Advances the clock an
| 70 | // 5. Advances the clock and verifies that the agent doesn't resend the |
| 71 | // operation status update. |
| 72 | TEST_P(AgentOperationFeedbackTest, RetryOperationStatusUpdate) |
| 73 | { |
| 74 | Clock::pause(); |
| 75 | |
| 76 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 77 | ASSERT_SOME(master); |
| 78 | |
| 79 | Owned<MasterDetector> detector = master.get()->createDetector(); |
| 80 | |
| 81 | slave::Flags slaveFlags = CreateSlaveFlags(); |
| 82 | |
| 83 | Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), slaveFlags); |
| 84 | ASSERT_SOME(slave); |
| 85 | |
| 86 | // Advance the clock to trigger agent registration. |
| 87 | Clock::advance(slaveFlags.registration_backoff_factor); |
| 88 | |
| 89 | // Register a framework to exercise an operation. |
| 90 | FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO; |
| 91 | frameworkInfo.set_roles(0, DEFAULT_TEST_ROLE); |
| 92 | |
| 93 | auto scheduler = std::make_shared<MockHTTPScheduler>(); |
| 94 | |
| 95 | EXPECT_CALL(*scheduler, connected(_)) |
| 96 | .WillOnce(scheduler::SendSubscribe(frameworkInfo)); |
| 97 | |
| 98 | Future<scheduler::Event::Subscribed> subscribed; |
| 99 | EXPECT_CALL(*scheduler, subscribed(_, _)) |
| 100 | .WillOnce(FutureArg<1>(&subscribed)); |
| 101 | |
| 102 | EXPECT_CALL(*scheduler, heartbeat(_)) |
| 103 | .WillRepeatedly(Return()); // Ignore heartbeats. |
| 104 | |
| 105 | Future<scheduler::Event::Offers> offers; |
| 106 | |
| 107 | // Set an expectation for the first offer. |
| 108 | EXPECT_CALL(*scheduler, offers(_, _)) |
| 109 | .WillOnce(FutureArg<1>(&offers)) |
| 110 | .WillRepeatedly(Return()); // Ignore subsequent offers. |
| 111 | |
| 112 | scheduler::TestMesos mesos(master.get()->pid, GetParam(), scheduler); |
| 113 | |
| 114 | AWAIT_READY(subscribed); |
| 115 | |
| 116 | const FrameworkID& frameworkId = subscribed->framework_id(); |
| 117 | |
| 118 | AWAIT_READY(offers); |
| 119 | |
| 120 | ASSERT_FALSE(offers->offers().empty()); |
| 121 | |
| 122 | const Offer& offer = offers->offers(0); |
| 123 | |
| 124 | // Reserve resources. |
| 125 | OperationID operationId; |
| 126 | operationId.set_value("operation"); |
| 127 | |
| 128 | ASSERT_FALSE(offer.resources().empty()); |
| 129 |
nothing calls this directly
no test coverage detected