'Assert that an attempt to create a dataset with a dataset_id that is
already assigned somewhere on the cluster results in an error response
and no configuration change.
A configuration with two nodes, ``NODE_A`` and ``NODE_B``, is created.
``NODE_A`` is given one unattached manifestation.  An attempt is made
to configure a new dataset is on ``primary`` which should be either
``NODE_A`` or ``NODE_B``.
:return: A ``Deferred`` that fires with the result of the test.'

def _dataset_id_collision_test(self, primary, modifier=(lambda uuid: uuid)):

    dataset_id = unicode(uuid4())
    existing_dataset = Dataset(dataset_id=dataset_id)
    existing_manifestation = Manifestation(dataset=existing_dataset, primary=True)
    saving = self.persistence_service.save(Deployment(nodes={Node(uuid=self.NODE_A_UUID, manifestations={existing_manifestation.dataset_id: existing_manifestation}), Node(uuid=self.NODE_B_UUID)}))
    def saved(ignored):
        return self.assertResult('POST', '/configuration/datasets', {u'primary': unicode(primary), u'dataset_id': modifier(dataset_id)}, CONFLICT, {u'description': u'The    provided    dataset_id    is    already    in    use.'})
    posting = saving.addCallback(saved)
    def failed(reason):
        deployment = self.persistence_service.get()
        (node_a, node_b) = deployment.nodes.values()
        if (node_a.uuid != self.NODE_A_UUID):
            (node_a, node_b) = (node_b, node_a)
        self.assertItemsEqual(({existing_manifestation.dataset_id: existing_manifestation}, {}), (node_a.manifestations, node_b.manifestations))
    posting.addCallback(failed)
    return posting
