aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/benchmarking/Dockerfile6
-rw-r--r--docker/core/Dockerfile6
-rw-r--r--docker/features/Dockerfile5
-rw-r--r--docker/healthcheck/Dockerfile6
-rw-r--r--docker/smoke/Dockerfile18
-rw-r--r--docker/tempest/Dockerfile18
-rw-r--r--docker/vnf/Dockerfile36
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py72
-rw-r--r--functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml42
-rw-r--r--functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh13
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py59
-rw-r--r--tox.ini1
12 files changed, 133 insertions, 149 deletions
diff --git a/docker/benchmarking/Dockerfile b/docker/benchmarking/Dockerfile
index 3afa5c483..7b98eade9 100644
--- a/docker/benchmarking/Dockerfile
+++ b/docker/benchmarking/Dockerfile
@@ -13,8 +13,10 @@ RUN apk --no-cache add --update libxml2 libxslt && \
> upper-constraints.txt && \
wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH | \
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
- git clone https://git.openstack.org/openstack/vmtp.git /src/vmtp && \
- (cd /src/vmtp && git fetch origin --tags $VMTP_TAG && git checkout FETCH_HEAD) && \
+ git init /src/vmtp && \
+ (cd /src/vmtp && \
+ git fetch --tags https://git.openstack.org/openstack/vmtp.git $VMTP_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/vmtp/ && \
pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
/src/vmtp && \
diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile
index 8f744db67..c1e7ede03 100644
--- a/docker/core/Dockerfile
+++ b/docker/core/Dockerfile
@@ -18,8 +18,10 @@ RUN apk --no-cache add --update \
pip install --no-cache-dir --src /src -cupper-constraints.txt \
-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \
-e git+https://git.openstack.org/openstack/requirements@$OPENSTACK_TAG#egg=openstack_requirements && \
- git clone --depth 1 https://gerrit.opnfv.org/gerrit/functest /src/functest && \
- (cd /src/functest && git fetch --depth 1 --tags origin $BRANCH && git checkout FETCH_HEAD) && \
+ git init /src/functest && \
+ (cd /src/functest && \
+ git fetch --tags https://gerrit.opnfv.org/gerrit/functest $BRANCH && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/functest && \
pip install --no-cache-dir --src /src -cupper-constraints.txt \
-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \
diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile
index 7024f9634..99de1eda5 100644
--- a/docker/features/Dockerfile
+++ b/docker/features/Dockerfile
@@ -14,7 +14,10 @@ RUN apk --no-cache add --update python3 sshpass && \
> upper-constraints.txt && \
wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH | \
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
- git clone --depth 1 -b $FDS_TAG https://gerrit.opnfv.org/gerrit/fds /src/fds && \
+ git init /src/fds && \
+ (cd /src/fds && \
+ git fetch --tags https://gerrit.opnfv.org/gerrit/fds $FDS_TAG && \
+ git checkout FETCH_HEAD) && \
pip install --no-cache-dir --src /src -cupper-constraints.txt \
-cupper-constraints.opnfv.txt \
-rthirdparty-requirements.txt && \
diff --git a/docker/healthcheck/Dockerfile b/docker/healthcheck/Dockerfile
index ccb61abf9..4a1c255b3 100644
--- a/docker/healthcheck/Dockerfile
+++ b/docker/healthcheck/Dockerfile
@@ -12,8 +12,10 @@ RUN wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/uppe
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
-rthirdparty-requirements.txt && \
- git clone --depth 1 https://git.opendaylight.org/gerrit/p/integration/test.git /src/odl_test && \
- (cd /src/odl_test && git fetch --depth 1 --tags origin $ODL_TAG && git checkout FETCH_HEAD) && \
+ git init /src/odl_test && \
+ (cd /src/odl_test && \
+ git fetch --tags https://git.opendaylight.org/gerrit/p/integration/test.git $ODL_TAG && \
+ git checkout FETCH_HEAD) && \
rm -r /src/odl_test/.git thirdparty-requirements.txt upper-constraints.txt \
upper-constraints.opnfv.txt
COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile
index 58d096108..c405330a6 100644
--- a/docker/smoke/Dockerfile
+++ b/docker/smoke/Dockerfile
@@ -15,14 +15,20 @@ RUN apk --no-cache add --virtual .build-deps --update \
> upper-constraints.txt && \
wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH | \
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
- git clone --depth 1 https://git.openstack.org/openstack/patrole.git /src/patrole && \
- (cd /src/patrole && git fetch --tags origin $PATROLE_TAG && git checkout FETCH_HEAD) && \
+ git init /src/patrole && \
+ (cd /src/patrole && \
+ git fetch --tags https://git.openstack.org/openstack/patrole.git $PATROLE_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/patrole/ && \
- git clone https://git.openstack.org/openstack/neutron-tempest-plugin.git /src/neutron-tempest-plugin && \
- (cd /src/neutron-tempest-plugin && git fetch --tags origin $NEUTRON_TAG && git checkout FETCH_HEAD) && \
+ git init /src/neutron-tempest-plugin && \
+ (cd /src/neutron-tempest-plugin && \
+ git fetch --tags https://git.openstack.org/openstack/neutron-tempest-plugin.git $NEUTRON_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/neutron-tempest-plugin && \
- git clone https://git.openstack.org/openstack/barbican-tempest-plugin.git /src/barbican-tempest-plugin && \
- (cd /src/barbican-tempest-plugin && git fetch --tags origin $BARBICAN_TAG && git checkout FETCH_HEAD) && \
+ git init /src/barbican-tempest-plugin && \
+ (cd /src/barbican-tempest-plugin && \
+ git fetch --tags https://git.openstack.org/openstack/barbican-tempest-plugin.git $BARBICAN_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/barbican-tempest-plugin/ && \
pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
/src/patrole /src/barbican-tempest-plugin /src/neutron-tempest-plugin \
diff --git a/docker/tempest/Dockerfile b/docker/tempest/Dockerfile
index d53457913..0cc947939 100644
--- a/docker/tempest/Dockerfile
+++ b/docker/tempest/Dockerfile
@@ -21,14 +21,20 @@ RUN apk --no-cache add --virtual .build-deps --update \
esac && \
wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH | \
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
- git clone --depth 1 https://git.openstack.org/openstack/os-faults.git /src/os-faults && \
- (cd /src/os-faults && git fetch --depth 1 --tags origin $OS_FAULTS_TAG && git checkout FETCH_HEAD) && \
+ git init /src/os-faults && \
+ (cd /src/os-faults && \
+ git fetch --tags https://git.openstack.org/openstack/os-faults.git $OS_FAULTS_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/os-faults/ && \
- git clone --depth 1 https://git.openstack.org/openstack/rally.git /src/rally && \
- (cd /src/rally && git fetch --depth 1 --tags origin $RALLY_TAG && git checkout FETCH_HEAD) && \
+ git init /src/rally && \
+ (cd /src/rally && \
+ git fetch --tags https://git.openstack.org/openstack/rally.git $RALLY_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/rally/ && \
- git clone --depth 1 https://git.openstack.org/openstack/rally-openstack.git /src/rally-openstack && \
- (cd /src/rally-openstack && git fetch --depth 1 --tags origin $RALLY_OPENSTACK_TAG && git checkout FETCH_HEAD) && \
+ git init /src/rally-openstack && \
+ (cd /src/rally-openstack && \
+ git fetch --tags https://git.openstack.org/openstack/rally-openstack.git $RALLY_OPENSTACK_TAG && \
+ git checkout FETCH_HEAD) && \
update-requirements -s --source /src/openstack-requirements /src/rally-openstack && \
pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
tempest /src/rally-openstack /src/os-faults && \
diff --git a/docker/vnf/Dockerfile b/docker/vnf/Dockerfile
index dfa520169..d081ff17f 100644
--- a/docker/vnf/Dockerfile
+++ b/docker/vnf/Dockerfile
@@ -27,18 +27,30 @@ RUN apk --no-cache add --update \
sed -E /#egg=functest/d > upper-constraints.opnfv.txt && \
git clone --depth 1 -b $VIMS_TEST_TAG https://github.com/Metaswitch/clearwater-live-test /src/vims-test && \
sed -i s/unf_ext\ \(.*\)/unf_ext\ \(0.0.7.4\)/g /src/vims-test/Gemfile.lock && \
- git clone https://github.com/Metaswitch/quaff /src/vims-test/quaff && \
- (cd /src/vims-test/quaff && git checkout $QUAFF_TAG) && \
- git clone --depth 1 https://github.com/Metaswitch/clearwater-build-infra /src/vims-test/build-infra && \
- (cd /src/vims-test/build-infra && git fetch --depth 1 --tags origin $VIMS_TEST_TAG && git checkout FETCH_HEAD) && \
- git clone --depth 1 https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater.git /src/cloudify_vims && \
- (cd /src/cloudify_vims && git fetch --depth 1 --tags origin $CLOUDIFY_VIMS_TAG && git checkout FETCH_HEAD) && \
- git clone --depth 1 https://github.com/Metaswitch/clearwater-heat.git /src/heat_vims && \
- (cd /src/heat_vims && git fetch --depth 1 --tags origin $HEAT_VIMS_TAG && git checkout FETCH_HEAD) && \
- git clone --depth 1 -b $VROUTER_TAG https://github.com/oolorg/opnfv-vnf-vyos-blueprint.git /src/opnfv-vnf-vyos-blueprint && \
- (cd /src/opnfv-vnf-vyos-blueprint && git fetch --depth 1 --tags origin $VROUTER_TAG && git checkout FETCH_HEAD) && \
- git clone --depth 1 https://github.com/RebacaInc/abot_charm.git /src/epc-requirements/abot_charm && \
- (cd /src/epc-requirements/abot_charm && git fetch --depth 1 --tags origin $ABOT_CHARM && git checkout FETCH_HEAD) && \
+ git init /src/vims-test/quaff && \
+ (cd /src/vims-test/quaff && \
+ git fetch --tags https://github.com/Metaswitch/quaff $QUAFF_TAG && \
+ git checkout FETCH_HEAD) && \
+ git init /src/vims-test/build-infra && \
+ (cd /src/vims-test/build-infra && \
+ git fetch --tags https://github.com/Metaswitch/clearwater-build-infra $VIMS_TEST_TAG && \
+ git checkout FETCH_HEAD) && \
+ git init /src/cloudify_vims && \
+ (cd /src/cloudify_vims && \
+ git fetch --tags https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater.git $CLOUDIFY_VIMS_TAG && \
+ git checkout FETCH_HEAD) && \
+ git init /src/heat_vims && \
+ (cd /src/heat_vims && \
+ git fetch --tags https://github.com/Metaswitch/clearwater-heat.git $HEAT_VIMS_TAG && \
+ git checkout FETCH_HEAD) && \
+ git init /src/opnfv-vnf-vyos-blueprint && \
+ (cd /src/opnfv-vnf-vyos-blueprint && \
+ git fetch --tags https://github.com/oolorg/opnfv-vnf-vyos-blueprint.git $VROUTER_TAG && \
+ git checkout FETCH_HEAD) && \
+ git init /src/epc-requirements/abot_charm && \
+ (cd /src/epc-requirements/abot_charm && \
+ git fetch --tags https://github.com/RebacaInc/abot_charm.git $ABOT_CHARM && \
+ git checkout FETCH_HEAD) && \
python3 -m pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
juju-wait==$JUJU_WAIT_TAG && \
go get github.com/rogpeppe/godeps && \
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index afaed4c65..a91059a2b 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -38,7 +38,7 @@ class RallyBase(singlevm.VmReady2):
# pylint: disable=too-many-instance-attributes
TESTS = ['authenticate', 'glance', 'cinder', 'gnocchi', 'heat',
- 'keystone', 'neutron', 'nova', 'quotas', 'vm', 'all']
+ 'keystone', 'neutron', 'nova', 'quotas']
RALLY_DIR = pkg_resources.resource_filename(
'functest', 'opnfv_tests/openstack/rally')
@@ -75,7 +75,6 @@ class RallyBase(singlevm.VmReady2):
project=self.project.project.id,
domain=self.project.domain.id)
self.creators = []
- self.mode = ''
self.summary = []
self.scenario_dir = ''
self.smoke = None
@@ -85,6 +84,9 @@ class RallyBase(singlevm.VmReady2):
self.details = None
self.compute_cnt = 0
self.flavor_alt = None
+ self.tests = []
+ self.task_file = ''
+ self.run_cmd = ''
def _build_task_args(self, test_file_name):
"""Build arguments for the Rally task."""
@@ -328,25 +330,11 @@ class RallyBase(singlevm.VmReady2):
else:
LOGGER.info('Test scenario: "%s" Failed.', test_name)
- def _run_task(self, test_name):
+ def run_task(self, test_name):
"""Run a task."""
LOGGER.info('Starting test scenario "%s" ...', test_name)
-
- task_file = os.path.join(self.RALLY_DIR, 'task.yaml')
- if not os.path.exists(task_file):
- LOGGER.error("Task file '%s' does not exist.", task_file)
- raise Exception("Task file '{}' does not exist.".format(task_file))
-
- file_name = self._prepare_test_list(test_name)
- if self.file_is_empty(file_name):
- LOGGER.info('No tests for scenario "%s"', test_name)
- return
-
- cmd = (["rally", "task", "start", "--abort-on-sla-failure", "--task",
- task_file, "--task-args",
- str(self._build_task_args(test_name))])
- LOGGER.debug('running command: %s', cmd)
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ LOGGER.debug('running command: %s', self.run_cmd)
+ proc = subprocess.Popen(self.run_cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
output = proc.communicate()[0]
@@ -356,7 +344,6 @@ class RallyBase(singlevm.VmReady2):
LOGGER.error("Failed to retrieve task_id")
LOGGER.error("Result:\n%s", output)
raise Exception("Failed to retrieve task id")
-
self._save_results(test_name, task_id)
def _append_summary(self, json_raw, test_name):
@@ -386,26 +373,43 @@ class RallyBase(singlevm.VmReady2):
'task_status': self.task_succeed(json_raw)}
self.summary.append(scenario_summary)
- def _prepare_env(self):
- """Create resources needed by test scenarios."""
+ def prepare_run(self):
+ """Prepare resources needed by test scenarios."""
assert self.cloud
LOGGER.debug('Validating the test name...')
- if self.test_name not in self.TESTS:
+ if self.test_name == 'all':
+ self.tests = self.TESTS
+ elif self.test_name in self.TESTS:
+ self.tests = [self.test_name]
+ else:
raise Exception("Test name '%s' is invalid" % self.test_name)
+ self.task_file = os.path.join(self.RALLY_DIR, 'task.yaml')
+ if not os.path.exists(self.task_file):
+ LOGGER.error("Task file '%s' does not exist.", self.task_file)
+ raise Exception("Task file '{}' does not exist.".
+ format(self.task_file))
+
self.compute_cnt = len(self.cloud.list_hypervisors())
self.flavor_alt = self.create_flavor_alt()
LOGGER.debug("flavor: %s", self.flavor_alt)
- def _run_tests(self):
+ def prepare_task(self, test_name):
+ """Prepare resources for test run."""
+ file_name = self._prepare_test_list(test_name)
+ if self.file_is_empty(file_name):
+ LOGGER.info('No tests for scenario "%s"', test_name)
+ return False
+ self.run_cmd = (["rally", "task", "start", "--abort-on-sla-failure",
+ "--task", self.task_file, "--task-args",
+ str(self._build_task_args(test_name))])
+ return True
+
+ def run_tests(self):
"""Execute tests."""
- if self.test_name == 'all':
- for test in self.TESTS:
- if test == 'all' or test == 'vm':
- continue
- self._run_task(test)
- else:
- self._run_task(self.test_name)
+ for test in self.tests:
+ if self.prepare_task(test):
+ self.run_task(test)
def _generate_report(self):
"""Generate test execution summary report."""
@@ -492,8 +496,8 @@ class RallyBase(singlevm.VmReady2):
OS_PROJECT_ID=self.project.project.id,
OS_PASSWORD=self.project.password)
conf_utils.create_rally_deployment(environ=environ)
- self._prepare_env()
- self._run_tests()
+ self.prepare_run()
+ self.run_tests()
self._generate_report()
res = testcase.TestCase.EX_OK
except Exception as exc: # pylint: disable=broad-except
@@ -512,7 +516,6 @@ class RallySanity(RallyBase):
if "case_name" not in kwargs:
kwargs["case_name"] = "rally_sanity"
super(RallySanity, self).__init__(**kwargs)
- self.mode = 'sanity'
self.test_name = 'all'
self.smoke = True
self.scenario_dir = os.path.join(self.RALLY_SCENARIO_DIR, 'sanity')
@@ -526,7 +529,6 @@ class RallyFull(RallyBase):
if "case_name" not in kwargs:
kwargs["case_name"] = "rally_full"
super(RallyFull, self).__init__(**kwargs)
- self.mode = 'full'
self.test_name = 'all'
self.smoke = False
self.scenario_dir = os.path.join(self.RALLY_SCENARIO_DIR, 'full')
diff --git a/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml b/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml
deleted file mode 100644
index 74f509925..000000000
--- a/functest/opnfv_tests/openstack/rally/scenario/opnfv-vm.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
- VMTasks.boot_runcommand_delete:
- -
- args:
- {{ vm_params(image_name, flavor_name) }}
- floating_network: {{ floating_network }}
- force_delete: false
- command:
- interpreter: /bin/sh
- script_file: {{ sup_dir }}/instance_dd_test.sh
- username: cirros
- nics:
- - net-id: {{ netid }}
- context:
- {% call user_context(tenants_amount, users_amount, use_existing_users) %}
- network: {}
- {% endcall %}
- runner:
- {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }}
- sla:
- {{ no_failures_sla() }}
-
- -
- args:
- {{ vm_params(image_name, flavor_name) }}
- fixed_network: private
- floating_network: {{ floating_network }}
- force_delete: false
- command:
- interpreter: /bin/sh
- script_file: {{ sup_dir }}/instance_dd_test.sh
- use_floatingip: true
- username: cirros
- nics:
- - net-id: {{ netid }}
- volume_args:
- size: 2
- context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
- runner:
- {{ constant_runner(concurrency=concurrency, times=iterations, is_smoke=smoke) }}
- sla:
- {{ no_failures_sla() }}
diff --git a/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh b/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh
deleted file mode 100644
index e3bf23405..000000000
--- a/functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-time_seconds(){ (time -p $1 ) 2>&1 |awk '/real/{print $2}'; }
-file=/tmp/test.img
-c=${1:-$SIZE}
-c=${c:-1000} #default is 1GB
-write_seq=$(time_seconds "dd if=/dev/zero of=$file bs=1M count=$c")
-read_seq=$(time_seconds "dd if=$file of=/dev/null bs=1M count=$c")
-[ -f $file ] && rm $file
-
-echo "{
- \"write_seq_${c}m\": $write_seq,
- \"read_seq_${c}m\": $read_seq
- }"
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index 401f043aa..d89ebd634 100644
--- a/functest/tests/unit/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
@@ -30,6 +30,7 @@ class OSRallyTesting(unittest.TestCase):
self.rally_base.image = munch.Munch(name='foo')
self.rally_base.flavor = munch.Munch(name='foo')
self.rally_base.flavor_alt = munch.Munch(name='bar')
+ self.rally_base.test_name = 'all'
self.assertTrue(mock_get_config.called)
self.assertTrue(mock_shade.called)
self.assertTrue(mock_new_project.called)
@@ -181,25 +182,21 @@ class OSRallyTesting(unittest.TestCase):
return_value=False)
def test_run_task_missing_task_file(self, mock_path_exists):
with self.assertRaises(Exception):
- self.rally_base._run_task('test_name')
+ self.rally_base.prepare_run()
mock_path_exists.assert_called()
- @mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists',
- return_value=True)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'_prepare_test_list', return_value='test_file_name')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'file_is_empty', return_value=True)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.LOGGER.info')
- def test_run_task_no_tests_for_scenario(self, mock_logger_info,
- mock_file_empty, mock_prep_list,
- mock_path_exists):
- self.rally_base._run_task('test_name')
+ def test_prepare_task_no_tests_for_scenario(
+ self, mock_logger_info, mock_file_empty, mock_prep_list):
+ self.rally_base.prepare_task('test_name')
mock_logger_info.assert_any_call('No tests for scenario \"%s\"',
'test_name')
mock_file_empty.assert_called()
mock_prep_list.assert_called()
- mock_path_exists.assert_called()
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'_prepare_test_list', return_value='test_file_name')
@@ -216,7 +213,7 @@ class OSRallyTesting(unittest.TestCase):
def test_run_task_taskid_missing(self, mock_logger_error, *args):
# pylint: disable=unused-argument
with self.assertRaises(Exception):
- self.rally_base._run_task('test_name')
+ self.rally_base.run_task('test_name')
text = 'Failed to retrieve task_id'
mock_logger_error.assert_any_call(text)
@@ -241,7 +238,7 @@ class OSRallyTesting(unittest.TestCase):
'_save_results')
def test_run_task_default(self, mock_save_res, *args):
# pylint: disable=unused-argument
- self.rally_base._run_task('test_name')
+ self.rally_base.run_task('test_name')
mock_save_res.assert_called()
@mock.patch('six.moves.builtins.open', mock.mock_open())
@@ -260,15 +257,15 @@ class OSRallyTesting(unittest.TestCase):
self.rally_base._save_results('test_name', '1234')
mock_summary.assert_called()
- def test_prepare_env_testname_invalid(self):
+ def test_prepare_run_testname_invalid(self):
self.rally_base.TESTS = ['test1', 'test2']
self.rally_base.test_name = 'test'
with self.assertRaises(Exception):
- self.rally_base._prepare_env()
+ self.rally_base.prepare_run()
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'get_external_network')
- def test_prepare_env_flavor_alt_creation_failed(self, *args):
+ def test_prepare_run_flavor_alt_creation_failed(self, *args):
# pylint: disable=unused-argument
self.rally_base.TESTS = ['test1', 'test2']
self.rally_base.test_name = 'test1'
@@ -278,26 +275,34 @@ class OSRallyTesting(unittest.TestCase):
side_effect=Exception) \
as mock_create_flavor:
with self.assertRaises(Exception):
- self.rally_base._prepare_env()
+ self.rally_base.prepare_run()
mock_list_hyperv.assert_called_once()
mock_create_flavor.assert_called_once()
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_run_task')
- def test_run_tests_all(self, mock_run_task):
- self.rally_base.TESTS = ['test1', 'test2']
+ 'prepare_task', return_value=True)
+ @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
+ 'run_task')
+ def test_run_tests_all(self, mock_run_task, mock_prepare_task):
+ self.rally_base.tests = ['test1', 'test2']
self.rally_base.test_name = 'all'
- self.rally_base._run_tests()
+ self.rally_base.run_tests()
+ mock_prepare_task.assert_any_call('test1')
+ mock_prepare_task.assert_any_call('test2')
mock_run_task.assert_any_call('test1')
mock_run_task.assert_any_call('test2')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_run_task')
- def test_run_tests_default(self, mock_run_task):
- self.rally_base.TESTS = ['test1', 'test2']
- self.rally_base.test_name = 'test1'
- self.rally_base._run_tests()
+ 'prepare_task', return_value=True)
+ @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
+ 'run_task')
+ def test_run_tests_default(self, mock_run_task, mock_prepare_task):
+ self.rally_base.tests = ['test1', 'test2']
+ self.rally_base.run_tests()
+ mock_prepare_task.assert_any_call('test1')
+ mock_prepare_task.assert_any_call('test2')
mock_run_task.assert_any_call('test1')
+ mock_run_task.assert_any_call('test2')
def test_clean_up_default(self):
with mock.patch.object(self.rally_base.orig_cloud,
@@ -309,9 +314,9 @@ class OSRallyTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils.'
'create_rally_deployment')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_prepare_env')
+ 'prepare_run')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_run_tests')
+ 'run_tests')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'_generate_report')
def test_run_default(self, *args):
@@ -328,8 +333,8 @@ class OSRallyTesting(unittest.TestCase):
@mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils.'
'create_rally_deployment', return_value=mock.Mock())
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_prepare_env', side_effect=Exception)
- def test_run_exception_prepare_env(self, mock_prep_env, *args):
+ 'prepare_run', side_effect=Exception)
+ def test_run_exception_prepare_run(self, mock_prep_env, *args):
# pylint: disable=unused-argument
self.assertEqual(self.rally_base.run(), testcase.TestCase.EX_RUN_ERROR)
mock_prep_env.assert_called()
diff --git a/tox.ini b/tox.ini
index 92a027104..b83cd61ff 100644
--- a/tox.ini
+++ b/tox.ini
@@ -111,7 +111,6 @@ basepython = python2.7
files =
functest/opnfv_tests/openstack/cinder/write_data.sh
functest/opnfv_tests/openstack/cinder/read_data.sh
- functest/opnfv_tests/openstack/rally/scenario/support/instance_dd_test.sh
functest/ci/convert_images.sh
functest/ci/download_images.sh
build.sh