def test_create_duplicate_name_race_condition(self):
        name = u"thename"

        # Create a dataset out-of-band with matching dataset ID and name
        # which the docker plugin won't be able to see.
        def create_after_list():
            # Clean up the patched version:
            del self.flocker_client.list_datasets_configuration
            # But first time we're called, we create dataset and lie about
            # its existence:
            d = self.flocker_client.create_dataset(
                self.NODE_A, int(DEFAULT_SIZE.to_Byte()),
                metadata={NAME_FIELD: name})
            d.addCallback(lambda _: DatasetsConfiguration(
                tag=u"1234", datasets={}))
            return d
        self.flocker_client.list_datasets_configuration = create_after_list

        return self.create(name)
If a dataset with the given name is created while the
dataset/ETHPy150Open ClusterHQ/flocker/flocker/dockerplugin/test/test_api.py/APITestsMixin.test_create_duplicate_name_race_condition