[Asterisk-code-review] Move 'config-path' option to 'TestCase' class (testsuite[master])
Kevin Harwell
asteriskteam at digium.com
Thu Jan 21 12:57:48 CST 2016
Kevin Harwell has uploaded a new change for review.
https://gerrit.asterisk.org/2058
Change subject: Move 'config-path' option to 'TestCase' class
......................................................................
Move 'config-path' option to 'TestCase' class
The 'config-path' option was originally part of the 'SimpleTestCase' class.
This patch moves that option up a class level and into 'TestCase' so that
tests that inherit from 'TestCase' can take advantage of the option.
Change-Id: I01fc604a144f9ecc9c64b8c9083f7ad382f88b9c
---
M lib/python/asterisk/test_case.py
M sample-yaml/simpletestcase-config.yaml.sample
M sample-yaml/test-config.yaml.sample
3 files changed, 12 insertions(+), 11 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/58/2058/1
diff --git a/lib/python/asterisk/test_case.py b/lib/python/asterisk/test_case.py
index ea24e0c..68c5a73 100644
--- a/lib/python/asterisk/test_case.py
+++ b/lib/python/asterisk/test_case.py
@@ -122,6 +122,7 @@
self.ast = []
self.ami = []
self.fastagi = []
+ self.base_config_path = None
self.reactor_timeout = 30
self.passed = None
self.fail_tokens = []
@@ -148,6 +149,8 @@
# Pull additional configuration from YAML config if possible
if test_config:
+ if 'config-path' in test_config:
+ self.base_config_path = test_config['config-path']
if 'reactor-timeout' in test_config:
self.reactor_timeout = test_config['reactor-timeout']
self.ast_conf_options = test_config.get('ast-config-options')
@@ -273,6 +276,8 @@
if local_num:
# If a base configuration for this Asterisk instance has been
# provided, install it first
+ if base_configs_path is None:
+ base_configs_path = self.base_config_path
if base_configs_path:
ast_dir = "%s/ast%d" % (base_configs_path, local_num)
self.ast[i].install_configs(ast_dir,
@@ -730,7 +735,6 @@
self._tracking_channels = []
self._ignore_originate_failures = False
self._spawn_after_hangup = False
- self._config_path = None
self._end_test_delay = 0
if test_config is None or 'test-iterations' not in test_config:
@@ -753,11 +757,9 @@
test_config['ignore-originate-failures']
if 'spawn-after-hangup' in test_config:
self._spawn_after_hangup = test_config['spawn-after-hangup']
- if 'config-path' in test_config:
- self._config_path = test_config['config-path']
self._end_test_delay = test_config.get('end-test-delay') or 0
- self.create_asterisk(count=1, base_configs_path=self._config_path)
+ self.create_asterisk(count=1)
def ami_connect(self, ami):
"""AMI connect handler"""
diff --git a/sample-yaml/simpletestcase-config.yaml.sample b/sample-yaml/simpletestcase-config.yaml.sample
index 74a024d..dd74131 100644
--- a/sample-yaml/simpletestcase-config.yaml.sample
+++ b/sample-yaml/simpletestcase-config.yaml.sample
@@ -23,13 +23,6 @@
# the previous iteration's channel has hung up.
spawn-after-hangup: True
- # A path to a configuration directory other than this test's configuration
- # directory. The configuration files from this common directory will be
- # installed prior to this test's configuration files. This is useful for
- # large sets of tests that cover the same functionality, and allows them
- # to share config files.
- config-path: 'tests/foo'
-
# The test iterations block define a sequence of sets of scenarios to run
# sequentially
test-iterations:
diff --git a/sample-yaml/test-config.yaml.sample b/sample-yaml/test-config.yaml.sample
index f282248..0ab04a2 100644
--- a/sample-yaml/test-config.yaml.sample
+++ b/sample-yaml/test-config.yaml.sample
@@ -211,6 +211,12 @@
# The configuration for the test object. The configuration will differ depending
# on the test object used
test-object-config:
+ # A path to a configuration directory other than this test's configuration
+ # directory. The configuration files from this common directory will be
+ # installed prior to this test's configuration files. This is useful for
+ # large sets of tests that cover the same functionality, and allows them
+ # to share config files.
+ config-path: 'tests/foo'
reactor-timeout: 30
spawn-after-hangup: True
# Whether a full log file containg DEBUG level should be created, defaults to True
--
To view, visit https://gerrit.asterisk.org/2058
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01fc604a144f9ecc9c64b8c9083f7ad382f88b9c
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-code-review
mailing list