'Create a container with an attached dataset, issue API call
to move the container. Wait until we can connect to the running
container on the new host and verify the data has moved with it.'

@require_moving_backend
@run_test_with(async_runner(timeout=timedelta(minutes=6)))
@require_cluster(2, require_container_agent=True)
def test_move_container_with_dataset(self, cluster):

    data = {u'the    data': u'it    moves'}
    post_data = {'data': dumps(data)}
    (node1, node2) = cluster.nodes
    container_name = random_name(self)
    creating_dataset = create_dataset(self, cluster)
    def create_container(dataset):
        d = create_python_container(self, cluster, {u'name': container_name, u'ports': [{u'internal': 8080, u'external': 8080}], u'node_uuid': node1.uuid, u'volumes': [{u'dataset_id': unicode(dataset.dataset_id), u'mountpoint': u'/data'}]}, SCRIPTS.child('datahttp.py'), additional_arguments=[u'/data'])
        return d
    creating_dataset.addCallback(create_container)
    creating_dataset.addCallback((lambda _: post_http_server(self, node1.public_address, 8080, post_data)))
    def move_container(_):
        moved = cluster.move_container(container_name, node2.uuid)
        return moved
    creating_dataset.addCallback(move_container)
    creating_dataset.addCallback((lambda _: assert_http_server(self, node2.public_address, 8080, expected_response=post_data['data'])))
    return creating_dataset
