From 82049af90e86380043c59741fa4e1cd2cf24aaa7 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 23 Jan 2012 11:51:14 +0000 Subject: Refactor away the flags.DEFINE_* helpers The next obvious step in porting to cfg is to define all options using cfg schemas directly rather than using the flags.DEFINE_* helpers. This is a large change, but it is almost entirely pure refactoring and does not result in any functional changes. The only change to note is that the default values for glance_host, glance_api_servers and default_publisher_id options are now using opt value interpolation i.e. -glance_host=_get_my_ip() +glance_host='$my_ip' -glance_api_servers=['%s:%d' % (FLAGS.glance_host, FLAGS.glance_port)] +glance_api_servers=['$glance_host:$glance_port'] -default_publisher_id=FLAGS.host +default_publisher_id='$host' Also note that the lower_bound check on the {report,periodic}_interval options are no more, but this has been true since cfg was first added. Change-Id: Ia58c8f0aaf61628bb55b1b8485118a2a9852ed17 --- nova/test.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'nova/test.py') diff --git a/nova/test.py b/nova/test.py index 1fc47f507..f8e9c390f 100644 --- a/nova/test.py +++ b/nova/test.py @@ -33,6 +33,7 @@ import mox import nose.plugins.skip import stubout +from nova.common import cfg from nova import flags import nova.image.fake from nova import log @@ -42,11 +43,17 @@ from nova.testing.fake import rabbit from nova.virt import fake +test_opts = [ + cfg.StrOpt('sqlite_clean_db', + default='clean.sqlite', + help='File name of clean sqlite db'), + cfg.BoolOpt('fake_tests', + default=True, + help='should we use everything for testing'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('sqlite_clean_db', 'clean.sqlite', - 'File name of clean sqlite db') -flags.DEFINE_bool('fake_tests', True, - 'should we use everything for testing') +FLAGS.add_options(test_opts) LOG = log.getLogger('nova.tests') -- cgit