def setUp(self): self.flags(use_ipv6=False) self.flags(glance_link_prefix=self._get_glance_host(), compute_link_prefix=self._get_host(), group='api') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) if not self.SUPPORTS_CELLS: # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() if not self.SUPPORTS_CELLS: self.useFixture(fixtures.Database()) self.useFixture(fixtures.Database(database='api')) self.useFixture(fixtures.DefaultFlavorsFixture()) self.useFixture(fixtures.SingleCellSimple()) super(ApiSampleTestBaseV21, self)._setup_services() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) if not self.all_extensions: # Set the whitelist to ensure only the extensions we are # interested in are loaded so the api samples don't include # data from extensions we are not interested in whitelist = API_V21_CORE_EXTENSIONS.copy() if self.extension_name: whitelist.add(self.extension_name) if self.extra_extensions_to_load: whitelist.update(set(self.extra_extensions_to_load)) CONF.set_override('extensions_whitelist', whitelist, 'osapi_v21') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) fake_utils.stub_out_utils_spawn_n(self.stubs) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) if not self.all_extensions: self.flags(osapi_compute_extension=[]) # Set the whitelist to ensure only the extensions we are # interested in are loaded so the api samples don't include # data from extensions we are not interested in whitelist = API_V3_CORE_EXTENSIONS.copy() if self.extension_name: whitelist.add(self.extension_name) if self.extra_extensions_to_load: whitelist.update(set(self.extra_extensions_to_load)) CONF.set_override('extensions_whitelist', whitelist, 'osapi_v21') expected_middleware = [] if (not hasattr(self, '_test') or (self._test == 'v2.1')): # NOTE(gmann)For v2.1 API testing, override /v2 endpoint with v2.1 self.useFixture(api_paste_fixture.ApiPasteFixture()) expected_middleware = [compute.APIRouterV21] elif self._test == 'v2.1_compatible': self.useFixture(api_paste_fixture.ApiPasteV2CompatibleFixture()) expected_middleware = [openstack.LegacyV2CompatibleWrapper, compute.APIRouterV21] super(ApiSampleTestBaseV3, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) fake_utils.stub_out_utils_spawn_n(self.stubs) self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None if expected_middleware: self._check_api_endpoint('/v2', expected_middleware)
def setUp(self): # TODO(gmann): Below condition is to skip the tests which running # for 'v2' and have not been merged yet. Once all tests are merged # this condition needs to be removed. if ((self._test == 'v2') and (self._api_version == 'v3')): raise testtools.TestCase.skipException('tests are not merged yet') self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host(), osapi_compute_extension=[]) if not self.all_extensions: # Set the whitelist to ensure only the extensions we are # interested in are loaded so the api samples don't include # data from extensions we are not interested in whitelist = API_V3_CORE_EXTENSIONS.copy() if self.extension_name: whitelist.add(self.extension_name) if self.extra_extensions_to_load: whitelist.update(set(self.extra_extensions_to_load)) CONF.set_override('extensions_whitelist', whitelist, 'osapi_v3') # TODO(gmann): Currently redirecting only merged tests # after merging all tests, second condition needs to be removed. if ((self._test == 'v2.1') and (self._api_version == 'v2')): # NOTE(gmann)For v2.1 API testing, override /v2 endpoint with v2.1 self.useFixture(api_paste_fixture.ApiPasteFixture()) super(ApiSampleTestBaseV3, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) fake_utils.stub_out_utils_spawn_n(self.stubs) self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False) self.flags(glance_link_prefix=self._get_glance_host(), compute_link_prefix=self._get_host(), group='api') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) if not self.SUPPORTS_CELLS: # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True # This is to enable the network quota which is being registered # based on CONF.enable_network_quota. Need this to test the # network quota in quota sample tests. self.flags(enable_network_quota=True) self.useFixture(fixtures.RegisterNetworkQuota()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() if not self.SUPPORTS_CELLS: self.useFixture(fixtures.Database()) self.useFixture(fixtures.Database(database='api')) self.useFixture(fixtures.DefaultFlavorsFixture()) self.useFixture(fixtures.SingleCellSimple()) super(ApiSampleTestBaseV21, self)._setup_services() if not self.USE_NEUTRON: # self.network is only setup if USE_NEUTRON=False self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None # NOTE(mikal): this is used to stub away privsep helpers def fake_noop(*args, **kwargs): return '', '' self.stub_out('nova.privsep.linux_net.add_bridge', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_mtu', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_enabled', fake_noop) self.stub_out('nova.privsep.linux_net.set_device_macaddr', fake_noop) self.stub_out('nova.privsep.linux_net.routes_show', fake_noop) self.stub_out('nova.privsep.linux_net.lookup_ip', fake_noop) self.stub_out('nova.privsep.linux_net.change_ip', fake_noop) self.stub_out('nova.privsep.linux_net.address_command_deprecated', fake_noop) if self.availability_zones: self.useFixture( fixtures.AvailabilityZoneFixture(self.availability_zones))
def setUp(self): extends = [] self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) if not self.all_extensions: if hasattr(self, 'extends_name'): extends = [self.extends_name] ext = [self.extension_name] if self.extension_name else [] self.flags(osapi_compute_extension=ext + extends) super(ApiSampleTestBaseV2, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) fake_utils.stub_out_utils_spawn_n(self.stubs) self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False) self.flags(glance_link_prefix=self._get_glance_host(), compute_link_prefix=self._get_host(), group='api') # load any additional fixtures specified by the scenario for fix in self._additional_fixtures: self.useFixture(fix()) if not self.SUPPORTS_CELLS: # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True # This is to enable the network quota which is being registered # based on CONF.enable_network_quota. Need this to test the # network quota in quota sample tests. self.flags(enable_network_quota=True) self.useFixture(fixtures.RegisterNetworkQuota()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't # change these later. super(ApiSampleTestBaseV21, self).setUp() if not self.SUPPORTS_CELLS: self.useFixture(fixtures.Database()) self.useFixture(fixtures.Database(database='api')) # FIXME(cdent): Placement db already provided by IntegratedHelpers self.useFixture(fixtures.Database(database='placement')) self.useFixture(fixtures.DefaultFlavorsFixture()) self.useFixture(fixtures.SingleCellSimple()) super(ApiSampleTestBaseV21, self)._setup_services() if not self.USE_NEUTRON: # self.network is only setup if USE_NEUTRON=False self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self) self.useFixture(fixtures.SpawnIsSynchronousFixture()) # this is used to generate sample docs self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None
def setUp(self): self.flags(use_ipv6=False, osapi_compute_link_prefix=self._get_host(), osapi_glance_link_prefix=self._get_glance_host()) if not self.all_extensions: # Set the whitelist to ensure only the extensions we are # interested in are loaded so the api samples don't include # data from extensions we are not interested in whitelist = API_V3_CORE_EXTENSIONS.copy() if self.extension_name: whitelist.add(self.extension_name) if self.extra_extensions_to_load: whitelist.update(set(self.extra_extensions_to_load)) CONF.set_override('extensions_whitelist', whitelist, 'osapi_v3') super(ApiSampleTestBaseV3, self).setUp() self.useFixture(test.SampleNetworks(host=self.network.host)) fake_network.stub_compute_with_ips(self.stubs) fake_utils.stub_out_utils_spawn_n(self.stubs) self.generate_samples = os.getenv('GENERATE_SAMPLES') is not None