def create_volume(self, name, driver=None, opts=None): vol = Volume(self.client, 'composetest', name, driver=driver, driver_opts=opts) self.tmp_volumes.append(vol) return vol
def create_volume(self, name, driver=None, opts=None, external=None): if external and isinstance(external, bool): external = name vol = Volume( self.client, 'composetest', name, driver=driver, driver_opts=opts, external_name=external ) self.tmp_volumes.append(vol) return vol
def create_volume(self, name, driver=None, opts=None, external=None, custom_name=False): if external: custom_name = True if isinstance(external, str): name = external vol = Volume( self.client, 'composetest', name, driver=driver, driver_opts=opts, external=bool(external), custom_name=custom_name ) self.tmp_volumes.append(vol) return vol
def test_remove_volume(self): vol = Volume(self.client, 'composetest', 'volume01') vol.create() vol.remove() volumes = self.client.volumes()['Volumes'] assert len([v for v in volumes if v['Name'] == vol.full_name]) == 0