Bay_create_timeout should be set to 60 default

Magnum need timeout to create bay. So '--timeout' can not be set
0 and its default value should be 60, like the stack_action_timeout
of heat.

Change-Id: Id879b6c1a495b0f1d09f3d583d3e09ab86032b6b
Closes-bug: #1590636
This commit is contained in:
PanFengyun 2016-07-14 07:40:31 +08:00
parent 2ce6320531
commit af74ab936d
3 changed files with 10 additions and 9 deletions

View File

@ -31,14 +31,15 @@ class TestCase(testtools.TestCase):
"""Run before each test method to initialize test environment."""
super(TestCase, self).setUp()
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 60)
try:
test_timeout = int(test_timeout)
except ValueError:
# If timeout value is invalid do not set a timeout.
test_timeout = 0
if test_timeout > 0:
self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
# If timeout value is invalid, set a default timeout.
test_timeout = 60
if test_timeout <= 0:
test_timeout = 60
self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
self.useFixture(fixtures.NestedTempfile())
self.useFixture(fixtures.TempHomeDir())

View File

@ -30,7 +30,7 @@ class FakeBay(Bay):
self.master_count = kwargs.get('master_count', 1)
self.node_count = kwargs.get('node_count', 1)
self.links = kwargs.get('links', [])
self.bay_create_timeout = kwargs.get('bay_create_timeout', 0)
self.bay_create_timeout = kwargs.get('bay_create_timeout', 60)
class ShellTest(shell_test_base.TestCommandLineArgument):

View File

@ -83,9 +83,9 @@ def do_bay_list(cs, args):
@utils.arg('--timeout',
metavar='<timeout>',
type=int,
default=0,
help='The timeout for bay creation in minutes. Set '
'to 0 for no timeout. The default is no timeout.')
default=60,
help='The timeout for bay creation in minutes. The default '
'is 60 minutes.')
def do_bay_create(cs, args):
"""Create a bay."""
baymodel = cs.baymodels.get(args.baymodel)