'A dataset can be deleted, resulting in its removal from the node.'

@flaky(u'FLOC-3196')
@require_cluster(1)
def test_dataset_deletion(self, cluster):

    created = create_dataset(self, cluster)
    def delete_dataset(dataset):
        deleted = cluster.client.delete_dataset(dataset.dataset_id)
        def not_exists():
            request = cluster.client.list_datasets_state()
            request.addCallback((lambda actual_datasets: (dataset.dataset_id not in (d.dataset_id for d in actual_datasets))))
            return request
        deleted.addCallback((lambda _: loop_until(reactor, not_exists)))
        return deleted
    created.addCallback(delete_dataset)
    return created
