Make CLI timeout tests configurable

Add an option for configuring the timeout used in the compute
and keystone CLI tests.

Closes-Bug: #1208846

Change-Id: Ia8f2fe528da7c6f294a1047d1d8b84239ce17adc
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 3aa0497..ab65914 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -365,6 +365,8 @@
 enabled = True
 # directory where python client binaries are located
 cli_dir = /usr/local/bin
+# Number of seconds to wait on a CLI timeout
+timeout = 15
 
 [service_available]
 # Whether or not cinder is expected to be available
diff --git a/tempest/cli/__init__.py b/tempest/cli/__init__.py
index 00e025d..f04d23f 100644
--- a/tempest/cli/__init__.py
+++ b/tempest/cli/__init__.py
@@ -35,6 +35,9 @@
     cfg.StrOpt('cli_dir',
                default='/usr/local/bin/',
                help="directory where python client binaries are located"),
+    cfg.IntOpt('timeout',
+               default=15,
+               help="Number of seconds to wait on a CLI timeout"),
 ]
 
 CONF = cfg.CONF
diff --git a/tempest/cli/simple_read_only/test_compute.py b/tempest/cli/simple_read_only/test_compute.py
index e60e238..4c7f604 100644
--- a/tempest/cli/simple_read_only/test_compute.py
+++ b/tempest/cli/simple_read_only/test_compute.py
@@ -176,7 +176,7 @@
         self.nova('list', flags='--debug')
 
     def test_admin_timeout(self):
-        self.nova('list', flags='--timeout 2')
+        self.nova('list', flags='--timeout %d' % CONF.cli.timeout)
 
     def test_admin_timing(self):
         self.nova('list', flags='--timing')
diff --git a/tempest/cli/simple_read_only/test_keystone.py b/tempest/cli/simple_read_only/test_keystone.py
index 4002081..4c7982b 100644
--- a/tempest/cli/simple_read_only/test_keystone.py
+++ b/tempest/cli/simple_read_only/test_keystone.py
@@ -18,9 +18,13 @@
 import re
 import subprocess
 
+from oslo.config import cfg
+
 import tempest.cli
 from tempest.openstack.common import log as logging
 
+CONF = cfg.CONF
+
 
 LOG = logging.getLogger(__name__)
 
@@ -117,4 +121,4 @@
         self.keystone('catalog', flags='--debug')
 
     def test_admin_timeout(self):
-        self.keystone('catalog', flags='--timeout 15')
+        self.keystone('catalog', flags='--timeout %d' % CONF.cli.timeout)