'``NodeStateCommand`` results in all connected ``ControlAMP``
connections getting the updated cluster state along with the
desired configuration.'

def test_nodestate_notifies_all_connected(self):

    self.control_amp_service.configuration_service.save(_TEST_DEPLOYMENT)
    agents = [FakeAgent(), FakeAgent()]
    clients = list((AgentAMP(Clock(), agent) for agent in agents))
    servers = list((LoopbackAMPClient(client.locator) for client in clients))
    for server in servers:
        delayed = DelayedAMPClient(server)
        self.control_amp_service.connected(delayed)
        self.reactor.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
        delayed.respond()
    self.successResultOf(self.client.callRemote(NodeStateCommand, state_changes=(NODE_STATE,), eliot_context=TEST_ACTION))
    self.reactor.advance((CONTROL_SERVICE_BATCHING_DELAY * 2))
    cluster_state = self.control_amp_service.cluster_state.as_deployment()
    expected = dict(configuration=_TEST_DEPLOYMENT, state=cluster_state)
    self.assertEqual(([expected] * len(agents)), list((dict(configuration=agent.desired, state=agent.actual) for agent in agents)))
