'A second configuration change is only transmitted after acknowledgement
of the first configuration change is received.'

def test_second_configuration_change_waits_for_first_acknowledgement(self):

    agent = FakeAgent()
    client = AgentAMP(Clock(), agent)
    service_clock = Clock()
    service = build_control_amp_service(self, service_clock)
    service.startService()
    confounding_agent = FakeAgent()
    confounding_client = AgentAMP(Clock(), confounding_agent)
    confounding_server = LoopbackAMPClient(confounding_client.locator)
    service.connected(confounding_server)
    service_clock.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
    configuration = service.configuration_service.get()
    modified_configuration = arbitrary_transformation(configuration)
    server = LoopbackAMPClient(client.locator)
    delayed_server = DelayedAMPClient(server)
    service.connected(delayed_server)
    service_clock.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
    first_agent_desired = agent.desired
    service.configuration_service.save(modified_configuration)
    service_clock.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
    second_agent_desired = agent.desired
    delayed_server.respond()
    service_clock.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
    third_agent_desired = agent.desired
    self.assertEqual(dict(first=configuration, second=configuration, third=modified_configuration), dict(first=first_agent_desired, second=second_agent_desired, third=third_agent_desired))
