From af74ab936de08eceadf3236a35b0c4d406a7ae5b Mon Sep 17 00:00:00 2001 From: PanFengyun Date: Thu, 14 Jul 2016 07:40:31 +0800 Subject: [PATCH] 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 --- magnumclient/tests/base.py | 11 ++++++----- magnumclient/tests/v1/test_bays_shell.py | 2 +- magnumclient/v1/bays_shell.py | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/magnumclient/tests/base.py b/magnumclient/tests/base.py index 0b5b1f44..75696794 100644 --- a/magnumclient/tests/base.py +++ b/magnumclient/tests/base.py @@ -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()) diff --git a/magnumclient/tests/v1/test_bays_shell.py b/magnumclient/tests/v1/test_bays_shell.py index 5194829c..ad1c5114 100644 --- a/magnumclient/tests/v1/test_bays_shell.py +++ b/magnumclient/tests/v1/test_bays_shell.py @@ -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): diff --git a/magnumclient/v1/bays_shell.py b/magnumclient/v1/bays_shell.py index 935c625a..32b3b4a2 100644 --- a/magnumclient/v1/bays_shell.py +++ b/magnumclient/v1/bays_shell.py @@ -83,9 +83,9 @@ def do_bay_list(cs, args): @utils.arg('--timeout', metavar='', 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)