summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py0
-rw-r--r--tests/data/output/hosts (renamed from tests/output/hosts)0
-rw-r--r--tests/data/schema/test_bm_schema.yaml (renamed from tests/schema/test_bm_schema.yaml)0
-rw-r--r--tests/data/schema/test_vm_schema.yaml (renamed from tests/schema/test_vm_schema.yaml)0
-rw-r--r--tests/data/test_plan/bm_ping.yaml (renamed from tests/test_case/bm_ping.yaml)0
-rw-r--r--tests/data/test_plan/bm_with_proxy.yaml (renamed from tests/test_case/bm_with_proxy.yaml)0
-rw-r--r--tests/data/test_plan/bm_without_proxy.yaml (renamed from tests/test_case/bm_without_proxy.yaml)0
-rw-r--r--tests/data/test_plan/vm.yaml (renamed from tests/test_case/vm.yaml)0
-rw-r--r--tests/data/test_plan/vm_error.yaml (renamed from tests/test_case/vm_error.yaml)0
-rw-r--r--tests/functional/__init__.py0
-rw-r--r--tests/functional/yaml_schema_test.py (renamed from tests/yaml_schema_test.py)0
-rw-r--r--tests/unit/__init__.py0
-rw-r--r--tests/unit/api/__init__.py0
-rw-r--r--tests/unit/api/qtip_server_test.py (renamed from tests/qtip_server_test.py)6
-rw-r--r--tests/unit/cli/__init__.py0
-rw-r--r--tests/unit/runner/__init__.py0
-rw-r--r--tests/unit/runner/perftest_test.py13
-rw-r--r--tests/unit/runner/suite_test.py13
-rw-r--r--tests/unit/runner/test_plan_test.py13
-rw-r--r--tests/unit/utils/__init__.py0
-rw-r--r--tests/unit/utils/ansible_api_test.py (renamed from tests/ansible_api_test.py)2
-rw-r--r--tests/unit/utils/args_handler_test.py (renamed from tests/args_handler_test.py)18
-rw-r--r--tests/unit/utils/cli_test.py (renamed from tests/cli_test.py)10
-rw-r--r--tests/unit/utils/create_zones_test.py (renamed from tests/create_zones_test.py)16
-rw-r--r--tests/unit/utils/driver_test.py (renamed from tests/driver_test.py)6
-rw-r--r--tests/unit/utils/env_setup_test.py (renamed from tests/env_setup_test.py)2
-rw-r--r--tests/unit/utils/spawn_vm_test.py (renamed from tests/spawn_vm_test.py)10
27 files changed, 74 insertions, 35 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/__init__.py
diff --git a/tests/output/hosts b/tests/data/output/hosts
index 9b47df0e..9b47df0e 100644
--- a/tests/output/hosts
+++ b/tests/data/output/hosts
diff --git a/tests/schema/test_bm_schema.yaml b/tests/data/schema/test_bm_schema.yaml
index a7c27e3f..a7c27e3f 100644
--- a/tests/schema/test_bm_schema.yaml
+++ b/tests/data/schema/test_bm_schema.yaml
diff --git a/tests/schema/test_vm_schema.yaml b/tests/data/schema/test_vm_schema.yaml
index 524f8fe4..524f8fe4 100644
--- a/tests/schema/test_vm_schema.yaml
+++ b/tests/data/schema/test_vm_schema.yaml
diff --git a/tests/test_case/bm_ping.yaml b/tests/data/test_plan/bm_ping.yaml
index 41d696e2..41d696e2 100644
--- a/tests/test_case/bm_ping.yaml
+++ b/tests/data/test_plan/bm_ping.yaml
diff --git a/tests/test_case/bm_with_proxy.yaml b/tests/data/test_plan/bm_with_proxy.yaml
index 1d73300b..1d73300b 100644
--- a/tests/test_case/bm_with_proxy.yaml
+++ b/tests/data/test_plan/bm_with_proxy.yaml
diff --git a/tests/test_case/bm_without_proxy.yaml b/tests/data/test_plan/bm_without_proxy.yaml
index a9ae3b71..a9ae3b71 100644
--- a/tests/test_case/bm_without_proxy.yaml
+++ b/tests/data/test_plan/bm_without_proxy.yaml
diff --git a/tests/test_case/vm.yaml b/tests/data/test_plan/vm.yaml
index 4c8453ca..4c8453ca 100644
--- a/tests/test_case/vm.yaml
+++ b/tests/data/test_plan/vm.yaml
diff --git a/tests/test_case/vm_error.yaml b/tests/data/test_plan/vm_error.yaml
index f13d3a00..f13d3a00 100644
--- a/tests/test_case/vm_error.yaml
+++ b/tests/data/test_plan/vm_error.yaml
diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/functional/__init__.py
diff --git a/tests/yaml_schema_test.py b/tests/functional/yaml_schema_test.py
index a975dca6..a975dca6 100644
--- a/tests/yaml_schema_test.py
+++ b/tests/functional/yaml_schema_test.py
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unit/__init__.py
diff --git a/tests/unit/api/__init__.py b/tests/unit/api/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unit/api/__init__.py
diff --git a/tests/qtip_server_test.py b/tests/unit/api/qtip_server_test.py
index 81bb302b..96544c95 100644
--- a/tests/qtip_server_test.py
+++ b/tests/unit/api/qtip_server_test.py
@@ -1,4 +1,4 @@
-import restful_server.qtip_server as server
+import qtip.api.qtip_server as server
import pytest
import json
import mock
@@ -66,7 +66,7 @@ class TestClass:
'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'}],
'result': 0})
])
- @mock.patch('restful_server.qtip_server.args_handler.prepare_and_run_benchmark')
+ @mock.patch('qtip.api.qtip_server.args_handler.prepare_and_run_benchmark')
def test_post_get_delete_job_successful(self, mock_args_handler, app_client, body, expected):
mock_args_handler.return_value = {'result': 0,
'detail': {'host': [(u'10.20.6.14', {'unreachable': 0,
@@ -107,7 +107,7 @@ class TestClass:
['job_id',
'It already has one job running now!'])
])
- @mock.patch('restful_server.qtip_server.args_handler.prepare_and_run_benchmark',
+ @mock.patch('qtip.api.qtip_server.args_handler.prepare_and_run_benchmark',
side_effect=[side_effect_sleep(0.5), side_effect_pass])
def test_post_two_jobs_unsuccessful(self, mock_args_hanler, app_client, body, expected):
reply_1 = app_client.post("/api/v1.0/jobs", data=body[0])
diff --git a/tests/unit/cli/__init__.py b/tests/unit/cli/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unit/cli/__init__.py
diff --git a/tests/unit/runner/__init__.py b/tests/unit/runner/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unit/runner/__init__.py
diff --git a/tests/unit/runner/perftest_test.py b/tests/unit/runner/perftest_test.py
new file mode 100644
index 00000000..798afadd
--- /dev/null
+++ b/tests/unit/runner/perftest_test.py
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+class TestPerfTest:
+ def test_list(self):
+ assert True
diff --git a/tests/unit/runner/suite_test.py b/tests/unit/runner/suite_test.py
new file mode 100644
index 00000000..a2023cf8
--- /dev/null
+++ b/tests/unit/runner/suite_test.py
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+class TestSuite:
+ def test_list(self):
+ assert True
diff --git a/tests/unit/runner/test_plan_test.py b/tests/unit/runner/test_plan_test.py
new file mode 100644
index 00000000..81f618c7
--- /dev/null
+++ b/tests/unit/runner/test_plan_test.py
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+class TestTestPlan:
+ def test_list(self):
+ assert True
diff --git a/tests/unit/utils/__init__.py b/tests/unit/utils/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unit/utils/__init__.py
diff --git a/tests/ansible_api_test.py b/tests/unit/utils/ansible_api_test.py
index a259c422..6b1afb44 100644
--- a/tests/ansible_api_test.py
+++ b/tests/unit/utils/ansible_api_test.py
@@ -6,7 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from utils.ansible_api import AnsibleApi
+from qtip.utils.ansible_api import AnsibleApi
class TestClass:
diff --git a/tests/args_handler_test.py b/tests/unit/utils/args_handler_test.py
index 625a42f5..b67fd993 100644
--- a/tests/args_handler_test.py
+++ b/tests/unit/utils/args_handler_test.py
@@ -8,28 +8,28 @@
##############################################################################
import pytest
import mock
-import utils.args_handler
+import qtip.utils.args_handler
class TestClass:
@pytest.mark.parametrize("test_input, expected", [
- (['fuel', '/home', './test_plan/default/network/iperf_bm.yaml'],
+ (['fuel', '/home', 'benchmarks/test_plan/default/network/iperf_bm.yaml'],
['fuel', '/home', "iperf",
[('1-server', ['10.20.0.23']), ('2-host', ['10.20.0.24'])],
"iperf_bm.yaml",
[('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 10)],
[("10.20.0.24", [None]), ("10.20.0.23", [None])], {}])
])
- @mock.patch('utils.args_handler.Env_setup.call_ping_test')
- @mock.patch('utils.args_handler.Env_setup.call_ssh_test')
- @mock.patch('utils.args_handler.Env_setup.update_ansible')
- @mock.patch('utils.args_handler.SpawnVM')
- @mock.patch('utils.args_handler.Driver.drive_bench')
+ @mock.patch('qtip.utils.args_handler.Env_setup.call_ping_test')
+ @mock.patch('qtip.utils.args_handler.Env_setup.call_ssh_test')
+ @mock.patch('qtip.utils.args_handler.Env_setup.update_ansible')
+ @mock.patch('qtip.utils.args_handler.SpawnVM')
+ @mock.patch('qtip.utils.args_handler.Driver.drive_bench')
def test_prepare_and_run_benchmark_successful(self, mock_driver, mock_sqawn_vm, mock_env_setup_ping,
mock_env_setup_ssh, mock_update_ansible, test_input, expected):
mock_ips = mock.Mock(return_value=["10.20.0.23", "10.20.0.24"])
- utils.args_handler.Env_setup.fetch_compute_ips = mock_ips
- utils.args_handler.prepare_and_run_benchmark(test_input[0], test_input[1], test_input[2])
+ qtip.utils.args_handler.Env_setup.fetch_compute_ips = mock_ips
+ qtip.utils.args_handler.prepare_and_run_benchmark(test_input[0], test_input[1], test_input[2])
call = mock_driver.call_args
call_args, call_kwargs = call
assert sorted(map(sorted, call_args)) == sorted(map(sorted, expected))
diff --git a/tests/cli_test.py b/tests/unit/utils/cli_test.py
index 255c2a37..86dd6b98 100644
--- a/tests/cli_test.py
+++ b/tests/unit/utils/cli_test.py
@@ -1,7 +1,7 @@
import pytest
import mock
import os
-from func.cli import Cli
+from qtip.utils.cli import Cli
from os.path import expanduser
@@ -10,7 +10,7 @@ class TestClass:
(['-l',
'zte',
'-f',
- 'compute'], "You have specified a lab that is not present under test_plan"),
+ 'compute'], "You have specified a lab that is not present under benchmarks/test_plan"),
(['-l',
'default',
'-f',
@@ -30,10 +30,10 @@ class TestClass:
(['-l',
'default',
'-f',
- 'storage'], [('fuel', '/home', './test_plan/default/storage/fio_bm.yaml'),
- ('fuel', '/home', './test_plan/default/storage/fio_vm.yaml')])
+ 'storage'], [('fuel', '/home', 'benchmarks/test_plan/default/storage/fio_bm.yaml'),
+ ('fuel', '/home', 'benchmarks/test_plan/default/storage/fio_vm.yaml')])
])
- @mock.patch('func.cli.args_handler.prepare_and_run_benchmark')
+ @mock.patch('qtip.utils.cli.args_handler.prepare_and_run_benchmark')
def test_cli_successful(self, mock_args_handler, test_input, expected):
k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel', 'PWD': '/home'})
k.start()
diff --git a/tests/create_zones_test.py b/tests/unit/utils/create_zones_test.py
index 0f57581d..8b1e97cc 100644
--- a/tests/create_zones_test.py
+++ b/tests/unit/utils/create_zones_test.py
@@ -2,7 +2,7 @@ import pytest
import mock
from mock import Mock, MagicMock
import os
-from utils.create_zones import AvailabilityZone
+from qtip.utils.create_zones import AvailabilityZone
return_list = []
@@ -57,13 +57,13 @@ class TestClass:
'add_host:compute1:10.20.0.4',
'create:compute2:compute2',
'add_host:compute2:10.20.0.5']),
- (['compute1', 'compute1'],
+ (['compute1'],
['create:compute1:compute1',
'add_host:compute1:10.20.0.4']),
])
- @mock.patch('utils.create_zones.client', autospec=True)
- @mock.patch('utils.create_zones.v2', autospec=True)
- @mock.patch('utils.create_zones.session')
+ @mock.patch('qtip.utils.create_zones.client', autospec=True)
+ @mock.patch('qtip.utils.create_zones.v2', autospec=True)
+ @mock.patch('qtip.utils.create_zones.session')
def test_create_zones_success(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd):
nova_obj = NovaMock()
mock_nova_client.Client.return_value = nova_obj()
@@ -88,9 +88,9 @@ class TestClass:
([],
[]),
])
- @mock.patch('utils.create_zones.client', autospec=True)
- @mock.patch('utils.create_zones.v2', autospec=True)
- @mock.patch('utils.create_zones.session')
+ @mock.patch('qtip.utils.create_zones.client', autospec=True)
+ @mock.patch('qtip.utils.create_zones.v2', autospec=True)
+ @mock.patch('qtip.utils.create_zones.session')
def test_clean_all_aggregates(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd):
global return_list
return_list = test_input
diff --git a/tests/driver_test.py b/tests/unit/utils/driver_test.py
index d3025bd2..432ce1ae 100644
--- a/tests/driver_test.py
+++ b/tests/unit/utils/driver_test.py
@@ -1,6 +1,6 @@
import pytest
import mock
-from utils.driver import Driver
+from qtip.utils.driver import Driver
from os.path import expanduser
HOME_DIR = expanduser('~')
@@ -65,8 +65,8 @@ class TestClass:
'bandwidthGbps': 0,
"role": "2-host"}])
])
- @mock.patch('utils.driver.AnsibleApi.execute_playbook')
- @mock.patch('utils.driver.AnsibleApi.get_detail_playbook_stats')
+ @mock.patch('qtip.utils.driver.AnsibleApi.execute_playbook')
+ @mock.patch('qtip.utils.driver.AnsibleApi.get_detail_playbook_stats')
def test_driver_success(self, mock_stats, mock_ansible, test_input, expected):
mock_ansible.return_value = True
mock_stats.return_value = [(u'10.20.6.14', {'unreachable': 0,
diff --git a/tests/env_setup_test.py b/tests/unit/utils/env_setup_test.py
index 07f426e1..e28c6a18 100644
--- a/tests/env_setup_test.py
+++ b/tests/unit/utils/env_setup_test.py
@@ -9,7 +9,7 @@
import pytest
import filecmp
-from utils.env_setup import Env_setup
+from qtip.utils.env_setup import Env_setup
import mock
diff --git a/tests/spawn_vm_test.py b/tests/unit/utils/spawn_vm_test.py
index c0d87cac..ba237378 100644
--- a/tests/spawn_vm_test.py
+++ b/tests/unit/utils/spawn_vm_test.py
@@ -2,7 +2,7 @@ import pytest
import mock
from mock import Mock, MagicMock
import os
-from utils.spawn_vm import SpawnVM
+from qtip.utils.spawn_vm import SpawnVM
class KeystoneMock(MagicMock):
@@ -40,10 +40,10 @@ class TestClass:
'role': ['1-server', '2-host']},
[('172.10.0.154', '')]),
])
- @mock.patch('utils.spawn_vm.Env_setup')
- @mock.patch('utils.spawn_vm.AvailabilityZone')
- @mock.patch('utils.spawn_vm.keystoneclient.v2_0', autospec=True)
- @mock.patch('utils.spawn_vm.heatclient.client', autospec=True)
+ @mock.patch('qtip.utils.spawn_vm.Env_setup')
+ @mock.patch('qtip.utils.spawn_vm.AvailabilityZone')
+ @mock.patch('qtip.utils.spawn_vm.keystoneclient.v2_0', autospec=True)
+ @mock.patch('qtip.utils.spawn_vm.heatclient.client', autospec=True)
def test_create_zones_success(self, mock_heat, mock_keystone,
mock_zone, mock_setup, test_input, expected):
open('./config/QtipKey.pub', 'a').close()