def test_volume_creation(self): """Test the creating of a dummy volume against a live endpoint""" # This command would create a volume similar to below # dcm-create-volume --budgetid 1512 --datacenter 1273 --size 1 --name mixcoatl-qa --description junk self.volume = Volume(endpoint=self.endpoint) self.volume.set_from_file("../../secret-test-data/vagrant-volume.json") self.volume.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8] self.job = self.volume.create() Job.wait_for(self.job.job_id, endpoint=self.endpoint) # force reload of job attributed from DCM API self.job.load() self.live_volume = Volume(volume_id=self.job.message, endpoint=self.endpoint) assert self.volume.data_center == self.live_volume.data_center assert self.volume.budget == self.live_volume.budget assert self.volume.size_in_gb == self.live_volume.size_in_gb assert self.volume.description == self.live_volume.description assert self.volume.name == self.live_volume.name
class TestVolumeLive: def setup(self): # load an endpoint that this file must be hosted outside of git # because it contains credentials self.endpoint = Endpoint.multiple_from_file( "../../secret-test-data/endpoints.json")['vagrant'] def test_volume_creation(self): """Test the creating of a dummy volume against a live endpoint""" # This command would create a volume similar to below # dcm-create-volume --budgetid 1512 --datacenter 1273 --size 1 --name mixcoatl-qa --description junk self.volume = Volume(endpoint=self.endpoint) self.volume.set_from_file("../../secret-test-data/vagrant-volume.json") self.volume.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8] self.job = self.volume.create() Job.wait_for(self.job.job_id, endpoint=self.endpoint) # force reload of job attributed from DCM API self.job.load() self.live_volume = Volume(volume_id=self.job.message, endpoint=self.endpoint) assert self.volume.data_center == self.live_volume.data_center assert self.volume.budget == self.live_volume.budget assert self.volume.size_in_gb == self.live_volume.size_in_gb assert self.volume.description == self.live_volume.description assert self.volume.name == self.live_volume.name def teardown(self): if hasattr(self, 'live_volume'): if self.live_volume: try: assert self.live_volume.destroy( reason="Mixcoatl QA test finished") except AssertionError: raise AssertionError( "Failed to destroy volume_id: %s with name: %s" % (self.live_volume.volume_id, self.live_volume.name))
class TestVolumeLive: def setup(self): # load an endpoint that this file must be hosted outside of git # because it contains credentials self.endpoint = Endpoint.multiple_from_file("../../secret-test-data/endpoints.json")['vagrant'] def test_volume_creation(self): """Test the creating of a dummy volume against a live endpoint""" # This command would create a volume similar to below # dcm-create-volume --budgetid 1512 --datacenter 1273 --size 1 --name mixcoatl-qa --description junk self.volume = Volume(endpoint=self.endpoint) self.volume.set_from_file("../../secret-test-data/vagrant-volume.json") self.volume.name = "mixcoatl-qa-%s" % str(uuid.uuid4())[:8] self.job = self.volume.create() Job.wait_for(self.job.job_id, endpoint=self.endpoint) # force reload of job attributed from DCM API self.job.load() self.live_volume = Volume(volume_id=self.job.message, endpoint=self.endpoint) assert self.volume.data_center == self.live_volume.data_center assert self.volume.budget == self.live_volume.budget assert self.volume.size_in_gb == self.live_volume.size_in_gb assert self.volume.description == self.live_volume.description assert self.volume.name == self.live_volume.name def teardown(self): if hasattr(self, 'live_volume'): if self.live_volume: try: assert self.live_volume.destroy(reason="Mixcoatl QA test finished") except AssertionError: raise AssertionError("Failed to destroy volume_id: %s with name: %s" % (self.live_volume.volume_id, self.live_volume.name))
if p_scripts is not None: new_server.p_scripts = p_scripts if cm_scripts is not None: new_server.cm_scripts = cm_scripts job_id = new_server.launch() jobs.append(job_id) # Watch server launch jobs watch_jobs() if sub[0]['subscribedVolume'] and cmd_args.novolumes is False and cmd_args.vol_type == '2': for vc in range(0, total_servers): name = "test-volume-"+name_generator() new_volume = Volume() new_volume.data_center = data_center_id new_volume.description = name new_volume.name = name new_volume.size_in_gb = 5 new_volume.budget = billing_code_id result = new_volume.create() print("Creating Volume : %s" % name) jobs.append(result.job_id) # Watch volume create jobs watch_jobs() if sub[0]['subscribedServer']: si = 0 for av in servers_launched: