'Datasets that are mounted at a path that matches the container\'s
volume are added to ``Application`` with same name as an
``AttachedVolume``.'

def test_discover_attached_volume(self):

    DATASET_ID = unicode(uuid4())
    DATASET_ID2 = unicode(uuid4())
    path1 = FilePath('/flocker').child(DATASET_ID.encode('ascii'))
    path2 = FilePath('/flocker').child(DATASET_ID2.encode('ascii'))
    manifestations = {dataset_id: Manifestation(dataset=Dataset(dataset_id=dataset_id), primary=True) for dataset_id in (DATASET_ID, DATASET_ID2)}
    current_known_state = NodeState(uuid=self.node_uuid, hostname=u'example.com', manifestations=manifestations, devices={}, paths={DATASET_ID: path1, DATASET_ID2: path2})
    unit1 = UNIT_FOR_APP.set('volumes', [DockerVolume(node_path=path1, container_path=FilePath('/var/lib/data'))])
    unit2 = UNIT_FOR_APP2.set('volumes', [DockerVolume(node_path=path2, container_path=FilePath('/var/lib/data'))])
    units = {unit1.name: unit1, unit2.name: unit2}
    applications = [app.set('volume', AttachedVolume(manifestation=manifestations[respective_id], mountpoint=FilePath('/var/lib/data'))) for (app, respective_id) in [(APP, DATASET_ID), (APP2, DATASET_ID2)]]
    self._verify_discover_state_applications(units, applications, current_state=current_known_state)
