<div dir="ltr"><br clear="all">My code looks like this, and it works just fine:<br><br>-----<br>docker_opts = [<br> cfg.IntOpt('registry_default_<div>port',<br> default=5042,<br> help=_('Default TCP port to find the '<br>
'docker-registry container'),<br> deprecated_group='DEFAULT',<br> deprecated_name='docker_registry_default_port'),<br> cfg.StrOpt('registry_default_ip',<br>
default='127.0.0.1',<br> help=_('Default IP address to find the '<br> 'docker-registry container'),),<br>]<br><br>CONF = cfg.CONF<br>CONF.register_opts(docker_opts, 'docker')<br>
-----<br><br></div>But my tests don't pick up the value..<br><br>==============================<div>========================================<br>FAIL: nova.tests.virt.docker.test_driver.DockerDriverTestCase.test_block_stats<br>
----------------------------------------------------------------------<br>Traceback (most recent call last):<br>_StringException: Empty attachments:<br> pythonlogging:''<br> stderr<br> stdout<br><br>Traceback (most recent call last):<br>
File "/home/judd/openstack/nova/nova/tests/virt/test_virt_drivers.py", line 49, in wrapped_func<br> return f(self, *args, **kwargs)<br> File "/home/judd/openstack/nova/nova/tests/virt/test_virt_drivers.py", line 485, in test_block_stats<br>
instance_ref, network_info = self._get_running_instance()<br> File "/home/judd/openstack/nova/nova/tests/virt/docker/test_driver.py", line 71, in _get_running_instance<br> [], 'herp', network_info=network_info)<br>
File "/home/judd/openstack/nova/nova/virt/docker/driver.py", line 294, in spawn<br> image_name = self._get_image_name(context, instance, image_meta)<br> File "/home/judd/openstack/nova/nova/virt/docker/driver.py", line 280, in _get_image_name<br>
return '{0}:{1}/{2}'.format(CONF.registry_default_ip,<br> File "/home/judd/openstack/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1648, in __getattr__<br> raise NoSuchOptError(name)<br>
NoSuchOptError: no such option: registry_default_ip<br><br>-----<br><br></div>What is the proper way to make a simple configuration value poke through to the tests?<br><br>The following does not help:<br><br><br>
from oslo.config import cfg<br><br>from nova import context<br>from nova import exception<br>from nova import test<br>from nova.tests import utils<br>import nova.tests.virt.docker.mock_<div>client<br>from nova.tests.virt.test_virt_drivers import _VirtDriverTestCase<br>
<br>CONF = cfg.CONF<br><br>class DockerDriverTestCase(_VirtDriverTestCase, test.TestCase):<br><br> driver_module = 'nova.virt.docker.DockerDriver'<br><br> def setUp(self):<br> super(DockerDriverTestCase, self).setUp()<br>
<br> self.flags(registry_default_ip='127.0.0.1', group='docker')</div><br>-- <br>Judd Maltin<br>T: 917-882-1270<br>F: 501-694-7809<span><br>what could possibly go wrong?</span><br><br><br>
</div>