def test_create_dir(self, mock_isdir, mock_makedirs): utils.create_dir("some") mock_makedirs.assert_called_once_with("some") mock_makedirs.reset_mock() utils.create_dir("some") mock_makedirs.assert_not_called()
def setup(self): self.conf.read(self.conf_path) utils.create_dir(self.data_dir) self._create_tempest_roles() self._configure_option("DEFAULT", "log_file", os.path.join(self.data_dir, "tempest.log")) self._configure_option("oslo_concurrency", "lock_path", os.path.join(self.data_dir, "lock_files")) self._configure_option("scenario", "img_dir", self.data_dir) self._configure_option("scenario", "img_file", self.image_name, helper_method=self._download_image) self._configure_option("compute", "image_ref", helper_method=self._discover_or_create_image) self._configure_option("compute", "image_ref_alt", helper_method=self._discover_or_create_image) self._configure_option("compute", "flavor_ref", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.flavor_ref_ram, flv_disk=conf.CONF.openstack.flavor_ref_disk) self._configure_option( "compute", "flavor_ref_alt", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.flavor_ref_alt_ram, flv_disk=conf.CONF.openstack.flavor_ref_alt_disk) if "neutron" in self.available_services: neutronclient = self.clients.neutron() if neutronclient.list_networks(shared=True)["networks"]: # If the OpenStack cloud has some shared networks, we will # create our own shared network and specify its name in the # Tempest config file. Such approach will allow us to avoid # failures of Tempest tests with error "Multiple possible # networks found". Otherwise the default behavior defined in # Tempest will be used and Tempest itself will manage network # resources. LOG.debug("Shared networks found. " "'fixed_network_name' option should be configured.") self._configure_option( "compute", "fixed_network_name", helper_method=self._create_network_resources) if "heat" in self.available_services: self._configure_option( "orchestration", "instance_type", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.heat_instance_type_ram) with open(self.conf_path, "w") as configfile: self.conf.write(configfile)
def install(self): """Clone and install a verifier.""" utils.create_dir(self.base_dir) self._clone() if self.verifier.system_wide: self.check_system_wide() else: self.install_venv()
def setup(self): self.conf.read(self.conf_path) utils.create_dir(self.data_dir) self._create_tempest_roles() self._configure_option("DEFAULT", "log_file", os.path.join(self.data_dir, "tempest.log")) self._configure_option("oslo_concurrency", "lock_path", os.path.join(self.data_dir, "lock_files")) self._configure_option("scenario", "img_dir", self.data_dir) self._configure_option("scenario", "img_file", self.image_name, helper_method=self._download_image) self._configure_option("compute", "image_ref", helper_method=self._discover_or_create_image) self._configure_option("compute", "image_ref_alt", helper_method=self._discover_or_create_image) self._configure_option("compute", "flavor_ref", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.flavor_ref_ram) self._configure_option("compute", "flavor_ref_alt", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.flavor_ref_alt_ram) if "neutron" in self.available_services: neutronclient = self.clients.neutron() if neutronclient.list_networks(shared=True)["networks"]: # If the OpenStack cloud has some shared networks, we will # create our own shared network and specify its name in the # Tempest config file. Such approach will allow us to avoid # failures of Tempest tests with error "Multiple possible # networks found". Otherwise the default behavior defined in # Tempest will be used and Tempest itself will manage network # resources. LOG.debug("Shared networks found. " "'fixed_network_name' option should be configured.") self._configure_option( "compute", "fixed_network_name", helper_method=self._create_network_resources) if "heat" in self.available_services: self._configure_option( "orchestration", "instance_type", helper_method=self._discover_or_create_flavor, flv_ram=conf.CONF.openstack.heat_instance_type_ram) with open(self.conf_path, "w") as configfile: self.conf.write(configfile)
def configure(self, extra_options=None): """Configure Tempest.""" utils.create_dir(self.home_dir) tcm = config.TempestConfigfileManager(self.verifier.deployment) return tcm.create(self.configfile, extra_options)