def setUp(self): super().setUp() self.fake_logger = fixtures.FakeLogger(level=logging.DEBUG) self.useFixture(self.fake_logger)
def setUp(self): super(BaseTestCase, self).setUp() self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
def setUp(self): super(BaseTestCase, self).setUp() self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs self.addCleanup(CONF.reset) self.useFixture(fixtures.FakeLogger('openstack.common')) self.useFixture(fixtures.Timeout(30, True))
def setUp(self): super().setUp() self.fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(self.fake_logger) self.project_options = snapcraft.ProjectOptions()
def setUp(self): super(BaseTestCase, self).setUp() self.useFixture(fixture.PluginDirectoryFixture()) # Enabling 'use_fatal_exceptions' allows us to catch string # substitution format errors in exception messages. mock.patch.object(exceptions.NeutronException, 'use_fatal_exceptions', return_value=True).start() db_options.set_defaults(cfg.CONF, connection='sqlite://') self.useFixture( fixtures.MonkeyPatch( 'oslo_config.cfg.find_config_files', lambda project=None, prog=None, extension=None: [])) self.setup_config() # Configure this first to ensure pm debugging support for setUp() debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') if debugger: self.addOnException( post_mortem_debug.get_exception_handler(debugger)) # Make sure we see all relevant deprecation warnings when running tests self.useFixture(fixture.WarningsFixture()) if bool_from_env('OS_DEBUG'): _level = std_logging.DEBUG else: _level = std_logging.INFO capture_logs = bool_from_env('OS_LOG_CAPTURE') if not capture_logs: std_logging.basicConfig(format=LOG_FORMAT, level=_level) self.log_fixture = self.useFixture( fixtures.FakeLogger( format=LOG_FORMAT, level=_level, nuke_handlers=capture_logs, )) test_timeout = get_test_timeout() if test_timeout == -1: test_timeout = 0 if test_timeout > 0: self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) # If someone does use tempfile directly, ensure that it's cleaned up self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) self.addCleanup(mock.patch.stopall) if bool_from_env('OS_STDOUT_CAPTURE'): stdout = self.useFixture(fixtures.StringStream('stdout')).stream self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) if bool_from_env('OS_STDERR_CAPTURE'): stderr = self.useFixture(fixtures.StringStream('stderr')).stream self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) self.addOnException(self.check_for_systemexit) self.orig_pid = os.getpid()
def test_record_logs_recording(self): logger = self.useFixture(fixtures.FakeLogger()) journal.record(self.db_context, *self.UPDATE_ROW) for arg in self.UPDATE_ROW[0:3]: self.assertIn(arg, logger.output)
def setUp(self): super(BaseTestCase, self).setUp() self.useFixture(fixtures.FakeLogger())
def setUp(self): super(LogTest, self).setUp() self.logger = self.useFixture( fixtures.FakeLogger(name=None, level=logging.INFO))
def setUp(self): super(TestBubblewrap, self).setUp() self.log_fixture = self.useFixture( fixtures.FakeLogger(level=logging.DEBUG)) self.useFixture(fixtures.NestedTempfile())
def test_snap_containerized(self, mock_inject, mock_container_run, mock_getuid): self.useFixture(fixtures.EnvironmentVariable('SUDO_UID', self.SUDO_UID)) mock_getuid.return_value = self.getuid mock_container_run.side_effect = lambda cmd, **kwargs: cmd fake_lxd = fixture_setup.FakeLXD() self.useFixture(fake_lxd) fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.useFixture( fixtures.EnvironmentVariable('SNAPCRAFT_CONTAINER_BUILDS', '1')) self.make_snapcraft_yaml() result = self.run_command(['snap']) self.assertThat(result.exit_code, Equals(0)) source = os.path.realpath(os.path.curdir) self.assertIn( 'Using default LXD remote because ' 'SNAPCRAFT_CONTAINER_BUILDS is set to 1\n' 'Waiting for a network connection...\n' 'Network connection established\n' 'Mounting {} into container\n'.format(source), fake_logger.output) container_name = 'local:snapcraft-snap-test' project_folder = '/root/build_snap-test' fake_lxd.check_call_mock.assert_has_calls([ call(['lxc', 'init', 'ubuntu:xenial', container_name]), call([ 'lxc', 'config', 'set', container_name, 'environment.SNAPCRAFT_SETUP_CORE', '1' ]), call([ 'lxc', 'config', 'set', container_name, 'environment.LC_ALL', 'C.UTF-8' ]), call([ 'lxc', 'config', 'set', container_name, 'environment.SNAPCRAFT_IMAGE_INFO', '{"fingerprint": "test-fingerprint", ' '"architecture": "test-architecture", ' '"created_at": "test-created-at"}' ]), call([ 'lxc', 'config', 'set', container_name, 'raw.idmap', 'both {} {}'.format(self.expected_idmap, '0') ]), call([ 'lxc', 'config', 'device', 'add', container_name, 'fuse', 'unix-char', 'path=/dev/fuse' ]), call(['lxc', 'start', container_name]), call([ 'lxc', 'config', 'device', 'add', container_name, project_folder, 'disk', 'source={}'.format(source), 'path={}'.format(project_folder) ]), call(['lxc', 'stop', '-f', container_name]), ]) mock_container_run.assert_has_calls([ call(['python3', '-c', mock.ANY]), call(['apt-get', 'update']), call(['apt-get', 'install', 'squashfuse', '-y']), call(['snapcraft', 'snap', '--output', 'snap-test_1.0_amd64.snap'], cwd=project_folder, user='******'), ])
def test_snap_containerized_exists_stopped(self, mock_inject, mock_container_run, mock_getuid): self.useFixture(fixtures.EnvironmentVariable('SUDO_UID', self.SUDO_UID)) mock_getuid.return_value = self.getuid mock_container_run.side_effect = lambda cmd, **kwargs: cmd fake_lxd = fixture_setup.FakeLXD() self.useFixture(fake_lxd) # Container was created before, and isn't running fake_lxd.devices = '{"/root/build_snap-test":[]}' fake_lxd.name = 'local:snapcraft-snap-test' fake_lxd.status = 'Stopped' fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.useFixture( fixtures.EnvironmentVariable('SNAPCRAFT_CONTAINER_BUILDS', '1')) self.make_snapcraft_yaml() result = self.run_command(['snap']) self.assertThat(result.exit_code, Equals(0)) self.assertIn( 'Waiting for a network connection...\n' 'Network connection established\n', fake_logger.output) container_name = 'local:snapcraft-snap-test' project_folder = '/root/build_snap-test' fake_lxd.check_call_mock.assert_has_calls([ call([ 'lxc', 'config', 'set', container_name, 'environment.SNAPCRAFT_SETUP_CORE', '1' ]), call([ 'lxc', 'config', 'set', container_name, 'environment.LC_ALL', 'C.UTF-8' ]), call([ 'lxc', 'config', 'set', container_name, 'environment.SNAPCRAFT_IMAGE_INFO', '{"fingerprint": "test-fingerprint", ' '"architecture": "test-architecture", ' '"created_at": "test-created-at"}' ]), call([ 'lxc', 'config', 'set', container_name, 'raw.idmap', 'both {} {}'.format(self.expected_idmap, 0) ]), call([ 'lxc', 'config', 'device', 'remove', container_name, project_folder ]), call([ 'lxc', 'config', 'device', 'add', container_name, 'fuse', 'unix-char', 'path=/dev/fuse' ]), call(['lxc', 'start', container_name]), call(['lxc', 'stop', '-f', container_name]), ]) mock_container_run.assert_has_calls([ call(['python3', '-c', mock.ANY]), call(['snapcraft', 'snap', '--output', 'snap-test_1.0_amd64.snap'], cwd=project_folder, user='******'), ]) # Ensure there's no unexpected calls eg. two network checks self.assertThat(mock_container_run.call_count, Equals(2))
def test_unknown_auth_strategy(self): self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) stdout, stderr = self.shell('--os-auth-strategy fake probe-list') self.assertFalse(stdout)
def setUp(self): super(TestCase, self).setUp() self.mox = mox.Mox() self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) self.time_patcher = mock.patch.object(time, 'time', lambda: 1234) self.time_patcher.start()
def test_build_verbose_with_kconfigfile(self): fake_logger = fixtures.FakeLogger(level=logging.DEBUG) self.useFixture(fake_logger) self.options.kconfigfile = "config" with open(self.options.kconfigfile, "w") as f: f.write("ACCEPT=y\n") plugin = kernel.KernelPlugin("test-part", self.options, self.project) self._simulate_build(plugin.sourcedir, plugin.builddir, plugin.installdir) plugin.build() self.assertThat(self.check_call_mock.call_count, Equals(4)) self.check_call_mock.assert_has_calls( [ mock.call( 'yes "" | make -j2 V=1 oldconfig', shell=True, cwd=plugin.builddir ), mock.call( ["unsquashfs", plugin.os_snap, "boot"], cwd="temporary-directory" ), mock.call( "cat temporary-directory/squashfs-root/boot/" "initrd.img-core | xz -dc | cpio -i", cwd=os.path.join(plugin.builddir, "initrd-staging"), shell=True, ), mock.call( "find . | cpio --create --format=newc | " "gzip > {}".format( os.path.join(plugin.installdir, "initrd-4.4.2.img") ), cwd=os.path.join(plugin.builddir, "initrd-staging"), shell=True, ), ] ) self.assertThat(self.run_mock.call_count, Equals(2)) self.run_mock.assert_has_calls( [ mock.call(["make", "-j2", "V=1", "bzImage", "modules"]), mock.call( [ "make", "-j2", "V=1", "CONFIG_PREFIX={}".format(plugin.installdir), "modules_install", "INSTALL_MOD_PATH={}".format(plugin.installdir), "firmware_install", "INSTALL_FW_PATH={}".format( os.path.join(plugin.installdir, "lib", "firmware") ), ] ), ] ) config_file = os.path.join(plugin.builddir, ".config") self.assertTrue(os.path.exists(config_file)) with open(config_file) as f: config_contents = f.read() self.assertThat(config_contents, Equals("ACCEPT=y\n")) self._assert_common_assets(plugin.installdir)
def setUp(self): super(TestTransportDebug, self).setUp() self.log_fixture = self.useFixture( fixtures.FakeLogger(level=logging.DEBUG), )
def test_yaml_valid_epochs(self, mock_loadPlugin): valid_epochs = [ { 'yaml': 0, 'expected': 0, }, { 'yaml': '"0"', 'expected': '0', }, { 'yaml': '1*', 'expected': '1*', }, { 'yaml': '"1*"', 'expected': '1*', }, { 'yaml': 1, 'expected': 1, }, { 'yaml': '"1"', 'expected': '1', }, { 'yaml': '400*', 'expected': '400*', }, { 'yaml': '"400*"', 'expected': '400*', }, { 'yaml': 1234, 'expected': 1234, }, { 'yaml': '"1234"', 'expected': '1234', }, { 'yaml': '0001', 'expected': 1, }, ] fake_logger = fixtures.FakeLogger(level=logging.ERROR) self.useFixture(fake_logger) for epoch in valid_epochs: with self.subTest(key=epoch): self.make_snapcraft_yaml("""name: test version: "1" summary: test description: nothing epoch: {} parts: part1: plugin: go stage-packages: [fswebcam] """.format(epoch['yaml'])) c = internal_yaml.Config() self.assertEqual(c.data['epoch'], epoch['expected'])
def setUp(self): super().setUp() temp_cwd_fixture = fixture_setup.TempCWD() self.useFixture(temp_cwd_fixture) self.path = temp_cwd_fixture.path # Use a separate path for XDG dirs, or changes there may be detected as # source changes. self.xdg_path = self.useFixture(fixtures.TempDir()).path self.useFixture(fixture_setup.TempXDG(self.xdg_path)) self.fake_terminal = fixture_setup.FakeTerminal() self.useFixture(self.fake_terminal) self.useFixture(fixture_setup.SilentSnapProgress()) # Some tests will directly or indirectly change the plugindir, which # is a module variable. Make sure that it is returned to the original # value when a test ends. self.addCleanup(common.set_plugindir, common.get_plugindir()) self.addCleanup(common.set_schemadir, common.get_schemadir()) self.addCleanup(common.set_extensionsdir, common.get_extensionsdir()) self.addCleanup(common.set_keyringsdir, common.get_keyringsdir()) self.addCleanup(common.reset_env) common.set_schemadir(os.path.join(get_snapcraft_path(), "schema")) self.fake_logger = fixtures.FakeLogger(level=logging.ERROR) self.useFixture(self.fake_logger) # Some tests will change the apt Dir::Etc::Trusted and # Dir::Etc::TrustedParts directories. Make sure they're properly reset. self.addCleanup( apt.apt_pkg.config.set, "Dir::Etc::Trusted", apt.apt_pkg.config.find_file("Dir::Etc::Trusted"), ) self.addCleanup( apt.apt_pkg.config.set, "Dir::Etc::TrustedParts", apt.apt_pkg.config.find_file("Dir::Etc::TrustedParts"), ) patcher = mock.patch("multiprocessing.cpu_count") self.cpu_count = patcher.start() self.cpu_count.return_value = 2 self.addCleanup(patcher.stop) # We do not want the paths to affect every test we have. patcher = mock.patch("snapcraft.file_utils.get_tool_path", side_effect=lambda x: x) patcher.start() self.addCleanup(patcher.stop) patcher = mock.patch("snapcraft.internal.indicators.ProgressBar", new=SilentProgressBar) patcher.start() self.addCleanup(patcher.stop) # These are what we expect by default self.snap_dir = os.path.join(os.getcwd(), "snap") self.prime_dir = os.path.join(os.getcwd(), "prime") self.stage_dir = os.path.join(os.getcwd(), "stage") self.parts_dir = os.path.join(os.getcwd(), "parts") self.local_plugins_dir = os.path.join(self.snap_dir, "plugins") # Use this host to run through the lifecycle tests self.useFixture( fixtures.EnvironmentVariable("SNAPCRAFT_BUILD_ENVIRONMENT", "host")) # Make sure snap installation does the right thing self.fake_snapd.installed_snaps = [ dict(name="core16", channel="latest/stable", revision="10"), dict(name="core18", channel="latest/stable", revision="10"), ] self.fake_snapd.snaps_result = [ dict(name="core16", channel="latest/stable", revision="10"), dict(name="core18", channel="latest/stable", revision="10"), ] self.fake_snapd.find_result = [ dict(core16=dict( channels={"latest/stable": dict(confinement="strict")})), dict(core18=dict( channels={"latest/stable": dict(confinement="strict")})), ] self.fake_snapd.snap_details_func = None self.fake_snap_command = fixture_setup.FakeSnapCommand() self.useFixture(self.fake_snap_command) # Avoid installing patchelf in the tests self.useFixture( fixtures.EnvironmentVariable("SNAPCRAFT_NO_PATCHELF", "1")) # Disable Sentry reporting for tests, otherwise they'll hang waiting # for input self.useFixture( fixtures.EnvironmentVariable("SNAPCRAFT_ENABLE_ERROR_REPORTING", "false")) # Don't let the managed host variable leak into tests self.useFixture(fixtures.EnvironmentVariable("SNAPCRAFT_MANAGED_HOST")) machine = os.environ.get("SNAPCRAFT_TEST_MOCK_MACHINE", None) self.base_environment = fixture_setup.FakeBaseEnvironment( machine=machine) self.useFixture(self.base_environment) # Make sure "SNAPCRAFT_ENABLE_DEVELOPER_DEBUG" is reset between tests self.useFixture( fixtures.EnvironmentVariable("SNAPCRAFT_ENABLE_DEVELOPER_DEBUG")) self.useFixture(fixture_setup.FakeSnapcraftctl())
def setUp(self): super(MuranoTestCase, self).setUp() self.useFixture(fixtures.FakeLogger('murano'))
def test_record_logs_dependencies(self): entry = db.create_pending_row(self.db_context, *self.UPDATE_ROW) logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) journal.record(self.db_context, *self.UPDATE_ROW) self.assertIn(str(entry.seqnum), logger.output)
def test_cleanbuild_copies_cache(self, mock_pet): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) mock_pet.return_value = 'my-pet' cache_dir = cache.SnapcraftCache().cache_root os.makedirs(cache_dir) open(os.path.join(cache_dir, 'foo'), 'w').close() project_options = ProjectOptions() lxd.Cleanbuilder('snap.snap', 'project.tar', project_options).execute() expected_arch = project_options.deb_arch self.assertEqual( 'Setting up container with project assets\n' 'Copying snapcraft cache into container\n' 'Waiting for a network connection...\n' 'Network connection established\n' 'Retrieved snap.snap\n', fake_logger.output) self.check_call_mock.assert_has_calls([ call([ 'lxc', 'launch', '-e', 'ubuntu:xenial/{}'.format(expected_arch), 'local:snapcraft-my-pet' ]), call([ 'lxc', 'config', 'set', 'local:snapcraft-my-pet', 'environment.SNAPCRAFT_SETUP_CORE', '1' ]), call([ 'lxc', 'file', 'push', 'project.tar', 'local:snapcraft-my-pet//root/project.tar' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'tar', 'xvf', '/root/project.tar' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'mkdir', '-p', '/root/.cache/snapcraft/.' ]), call([ 'lxc', 'file', 'push', os.path.join(cache_dir, 'foo'), 'local:snapcraft-my-pet//root/.cache/snapcraft/./foo' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'python3', '-c', 'import urllib.request; ' 'urllib.request.urlopen(' '"http://start.ubuntu.com/connectivity-check.html", ' 'timeout=5)' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'apt-get', 'update' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'apt-get', 'install', 'snapcraft', '-y' ]), call([ 'lxc', 'exec', 'local:snapcraft-my-pet', '--', 'snapcraft', 'snap', '--output', 'snap.snap' ]), call([ 'lxc', 'file', 'pull', 'local:snapcraft-my-pet//root/snap.snap', 'snap.snap' ]), call(['lxc', 'stop', '-f', 'local:snapcraft-my-pet']), ])
def test_run_unknown_command(self): self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) stdout, stderr = self.shell('fake', check=True) self.assertFalse(stdout) self.assertEqual("Unknown command ['fake']", stderr.strip())
def setUp(self): super(OSConfigApplierTestCase, self).setUp() self.useFixture(fixtures.FakeLogger('os-config-applier')) self.useFixture(fixtures.NestedTempfile())
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) try: test_timeout = int(test_timeout) except ValueError: # If timeout value is invalid do not set a timeout. test_timeout = 0 if self.TIMEOUT_SCALING_FACTOR >= 0: test_timeout *= self.TIMEOUT_SCALING_FACTOR else: raise ValueError('TIMEOUT_SCALING_FACTOR value must be >= 0') if test_timeout > 0: self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) self.useFixture(TranslationFixture()) self.useFixture(log_fixture.get_logging_handle_error_fixture()) if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES: stdout = self.useFixture(fixtures.StringStream('stdout')).stream self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES: stderr = self.useFixture(fixtures.StringStream('stderr')).stream self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) rpc.add_extra_exmods('nova.test') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) # set root logger to debug root = logging.getLogger() root.setLevel(logging.DEBUG) # supports collecting debug level for local runs if os.environ.get('OS_DEBUG') in _TRUE_VALUES: level = logging.DEBUG else: level = logging.INFO # Collect logs fs = '%(asctime)s %(levelname)s [%(name)s] %(message)s' self.useFixture(fixtures.FakeLogger(format=fs, level=None)) root.handlers[0].setLevel(level) if level > logging.DEBUG: # Just attempt to format debug level logs, but don't save them handler = NullHandler() self.useFixture(fixtures.LogHandler(handler, nuke_handlers=False)) handler.setLevel(logging.DEBUG) self.useFixture(conf_fixture.ConfFixture(CONF)) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = 'fake' self.useFixture(self.messaging_conf) rpc.init(CONF) if self.USES_DB: global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database(session, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.database.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db) self.useFixture(_DB_CACHE) # NOTE(danms): Make sure to reset us back to non-remote objects # for each test to avoid interactions. Also, backup the object # registry. objects_base.NovaObject.indirection_api = None self._base_test_obj_backup = copy.copy( objects_base.NovaObject._obj_classes) self.addCleanup(self._restore_obj_registry) # NOTE(mnaser): All calls to utils.is_neutron() are cached in # nova.utils._IS_NEUTRON. We set it to None to avoid any # caching of that value. utils._IS_NEUTRON = None mox_fixture = self.useFixture(moxstubout.MoxStubout()) self.mox = mox_fixture.mox self.stubs = mox_fixture.stubs self.addCleanup(self._clear_attrs) self.useFixture(fixtures.EnvironmentVariable('http_proxy')) self.policy = self.useFixture(policy_fixture.PolicyFixture()) CONF.set_override('fatal_exception_format_errors', True) CONF.set_override('enabled', True, 'osapi_v3') CONF.set_override('force_dhcp_release', False) CONF.set_override('periodic_enable', False) # We don't need to kill ourselves in deprecation floods. Give # me a ping, Vasily. One ping only, please. warnings.simplefilter("once", DeprecationWarning)
def setUp(self): super(TestEc2, self).setUp() self.log = self.useFixture(fixtures.FakeLogger())
def setUp(self): super().setUp() self.fake_logger = fixtures.FakeLogger(level=logging.DEBUG) self.useFixture(self.fake_logger) self.fake_terminal = tests.fixture_setup.FakeTerminal() self.useFixture(self.fake_terminal)
def test_cleanbuild(self): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.useFixture(tests.fixture_setup.FakeLXD())
def setUp(self): super(BaseTestCase, self).setUp() self._set_timeout() self._fake_output() self.useFixture(fixtures.FakeLogger('ami.openstack.common')) self.useFixture(fixtures.NestedTempfile())
def test_request_non_admin(self): self.config_fixture.config(admin_token='ADMIN') log_fix = self.useFixture(fixtures.FakeLogger()) headers = {authorization.AUTH_TOKEN_HEADER: 'NOT-ADMIN'} self._do_middleware_request(headers=headers) self.assertIn('Invalid user token', log_fix.output)
def setUp(self): super(TracerTest, self).setUp() self.useFixture(fixtures.FakeLogger())
def setUp(self): super(TestRequestBase, self).setUp() self.log = self.useFixture(fixtures.FakeLogger()) collect.setup_conf() cfg.CONF.request.metadata_url = 'http://192.0.2.1:8000/my_metadata'