'An FSM doing convergence that gets a discovery result supplies an
updated ``cluster_state`` to ``calculate_necessary_state_changes``.'

@validate_logging(assertHasMessage, LOG_CALCULATED_ACTIONS)
def test_convergence_done_update_local_state(self, logger):

    local_node_hostname = u'192.0.2.123'
    received_node = NodeState(hostname=local_node_hostname)
    received_cluster_state = DeploymentState(nodes=[received_node])
    discovered_manifestation = Manifestation(dataset=Dataset(dataset_id=uuid4()), primary=True)
    local_node_state = NodeState(hostname=local_node_hostname, manifestations={discovered_manifestation.dataset_id: discovered_manifestation}, devices={}, paths={})
    client = self.make_amp_client([local_node_state])
    action = ControllableAction(result=Deferred())
    deployer = ControllableDeployer(local_node_hostname, [succeed(local_node_state)], [action])
    fsm = build_convergence_loop_fsm(Clock(), deployer)
    self.patch(fsm, 'logger', logger)
    fsm.receive(_ClientStatusUpdate(client=client, configuration=Deployment(nodes=[to_node(local_node_state)]), state=received_cluster_state))
    expected_local_cluster_state = DeploymentState(nodes=[local_node_state])
    [calculate_necessary_state_changes_inputs] = deployer.calculate_inputs
    (_, _, actual_cluster_state) = calculate_necessary_state_changes_inputs
    self.assertEqual(expected_local_cluster_state, actual_cluster_state)
