summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cli_test.py20
-rw-r--r--tests/create_zones_test.py89
-rw-r--r--tests/driver_test.py65
-rw-r--r--tests/env_setup_test.py59
-rw-r--r--tests/fetchimg_test.py22
-rw-r--r--tests/output/hosts3
-rw-r--r--tests/schema/test_bm_schema.yaml75
-rw-r--r--tests/schema/test_vm_schema.yaml80
-rw-r--r--tests/spawn_vm_test.py71
-rw-r--r--tests/test_case/bm_ping.yaml29
-rw-r--r--tests/test_case/bm_with_proxy.yaml39
-rw-r--r--tests/test_case/bm_without_proxy.yaml33
-rw-r--r--tests/test_case/vm.yaml48
-rw-r--r--tests/test_case/vm_error.yaml42
-rw-r--r--tests/yaml_schema_test.py16
15 files changed, 691 insertions, 0 deletions
diff --git a/tests/cli_test.py b/tests/cli_test.py
new file mode 100644
index 00000000..f12e8fed
--- /dev/null
+++ b/tests/cli_test.py
@@ -0,0 +1,20 @@
+import pytest
+from func.cli import cli
+
+
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ (['-l',
+ 'zte',
+ '-f',
+ 'compute'], "You have specified a lab that is not present in test_cases"),
+ (['-l',
+ 'zte-pod1',
+ '-f',
+ 'test'], "Test File Does not exist in test_list")
+ ])
+ def test_cli_error(self, capfd, test_input, expected):
+ with pytest.raises(SystemExit):
+ cli(test_input)
+ resout, reserr = capfd.readouterr()
+ assert expected in resout
diff --git a/tests/create_zones_test.py b/tests/create_zones_test.py
new file mode 100644
index 00000000..e431a907
--- /dev/null
+++ b/tests/create_zones_test.py
@@ -0,0 +1,89 @@
+import pytest
+import mock
+from mock import Mock, MagicMock
+import os
+from func.create_zones import create_zones
+
+return_list = []
+
+
+def get_agg_mock(host):
+ agg = Mock()
+ agg.name = host
+ agg.id = host
+ return agg
+
+
+class HyperMock(MagicMock):
+ def list(self):
+ mock_hypervisor = [Mock(service={'host': '10.20.0.4'}), Mock(service={'host': '10.20.0.5'})]
+ return mock_hypervisor
+
+
+class AggMock(MagicMock):
+ def get_details(self, agg_id):
+ print "get_detail:{0}".format(agg_id)
+ return Mock(hosts=[])
+
+ def create(self, host, agg):
+ print "create:{0}:{1}".format(host, agg)
+ return agg
+
+ def list(self):
+ return return_list
+
+ def delete(self, agg_id):
+ print "delete:{0}".format(agg_id)
+ pass
+
+ def add_host(self, aggregate, host):
+ print "add_host:{0}:{1}".format(aggregate, host)
+ pass
+
+ def remove_host(self, agg_id, host):
+ pass
+
+
+class NovaMock(MagicMock):
+ hypervisors = HyperMock()
+ aggregates = AggMock()
+
+
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ ([[], ['compute1', 'compute2']],
+ ['create:10.20.0.4:compute1',
+ 'add_host:compute1:10.20.0.4',
+ 'create:10.20.0.5:compute2',
+ 'add_host:compute2:10.20.0.5']),
+ ([[get_agg_mock('10.20.0.4'), get_agg_mock('10.20.0.5')], ['compute1', 'compute2']],
+ ['delete:10.20.0.4',
+ 'create:10.20.0.4:compute1',
+ 'get_detail:10.20.0.4',
+ 'add_host:10.20.0.4:10.20.0.4',
+ 'delete:10.20.0.5',
+ 'create:10.20.0.5:compute2',
+ 'get_detail:10.20.0.5',
+ 'add_host:10.20.0.5:10.20.0.5']),
+ ([[], ['compute1', 'compute5']],
+ ['The specified compute node doesnt exist. using compute 1'])
+ ])
+ @mock.patch('func.create_zones.client', autospec=True)
+ @mock.patch('func.create_zones.v2', autospec=True)
+ @mock.patch('func.create_zones.session')
+ def test_create_zones_success(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd):
+ global return_list
+ return_list = test_input[0]
+ nova_obj = NovaMock()
+ mock_nova_client.Client.return_value = nova_obj()
+ k = mock.patch.dict(os.environ, {'OS_AUTH_URL': 'http://172.10.0.5:5000',
+ 'OS_USERNAME': 'admin',
+ 'OS_PASSWORD': 'admin',
+ 'OS_TENANT_NAME': 'admin'})
+ k.start()
+ create = create_zones()
+ create.create_agg(test_input[1])
+ k.stop()
+ resout, reserr = capfd.readouterr()
+ for x in expected:
+ assert x in resout
diff --git a/tests/driver_test.py b/tests/driver_test.py
new file mode 100644
index 00000000..39adc939
--- /dev/null
+++ b/tests/driver_test.py
@@ -0,0 +1,65 @@
+import pytest
+import mock
+import os
+import json
+from func.driver import Driver
+
+
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ (["iperf",
+ [('host', ['10.20.0.13', '10.20.0.15'])],
+ "iperf_bm.yaml",
+ [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
+ [("10.20.0.13", [None]), ("10.20.0.15", [None])],
+ {'http_proxy': 'http://10.20.0.1:8118',
+ 'https_proxy': 'http://10.20.0.1:8118',
+ 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'},
+ 'fuel'],
+ {'Dest_dir': 'results',
+ 'ip1': '',
+ 'ip2': '',
+ 'installer': 'fuel',
+ 'workingdir': '/home',
+ 'fname': 'iperf_bm.yaml',
+ 'username': 'root',
+ 'http_proxy': 'http://10.20.0.1:8118',
+ 'https_proxy': 'http://10.20.0.1:8118',
+ 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*',
+ 'duration': 20,
+ 'protocol': 'tcp',
+ 'bandwidthGbps': 0,
+ "role": "host"}),
+ (["iperf",
+ [('1-server', ['10.20.0.13']), ('2-host', ['10.20.0.15'])],
+ "iperf_vm.yaml",
+ [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
+ [("10.20.0.13", [None]), ("10.20.0.15", [None])],
+ {},
+ 'joid'],
+ {'Dest_dir': 'results',
+ 'ip1': '10.20.0.13',
+ 'ip2': '',
+ 'installer': 'joid',
+ "privateip1": "NONE",
+ 'workingdir': '/home',
+ 'fname': 'iperf_vm.yaml',
+ 'username': 'ubuntu',
+ 'duration': 20,
+ 'protocol': 'tcp',
+ 'bandwidthGbps': 0,
+ "role": "2-host"})
+ ])
+ @mock.patch('func.driver.os.system')
+ def test_driver_success(self, mock_system, test_input, expected):
+ mock_system.return_value = True
+ k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': test_input[6], 'PWD': '/home'})
+ k.start()
+ dri = Driver()
+ dri.drive_bench(test_input[0], test_input[1], test_input[2], test_input[3], test_input[4], test_input[5])
+ call = mock_system.call_args
+ k.stop()
+ call_args, call_kwargs = call
+ real_call = call_args[0].split('extra-vars \'')[1]
+ real_call = real_call[0: len(real_call) - 1]
+ assert json.loads(real_call) == json.loads(json.dumps(expected))
diff --git a/tests/env_setup_test.py b/tests/env_setup_test.py
new file mode 100644
index 00000000..9112ff94
--- /dev/null
+++ b/tests/env_setup_test.py
@@ -0,0 +1,59 @@
+import pytest
+import filecmp
+from func.env_setup import Env_setup
+
+
+class TestClass:
+
+ @pytest.mark.parametrize("test_input, expected", [
+ ("tests/test_case/bm_with_proxy.yaml", ["dhrystone",
+ {},
+ [],
+ {'http_proxy': 'http://10.20.0.1:8118',
+ 'https_proxy': 'http://10.20.0.1:8118',
+ 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}]),
+ ("tests/test_case/bm_without_proxy.yaml", ["dhrystone",
+ {},
+ [],
+ {}]),
+ ("tests/test_case/vm.yaml", ["iperf",
+ {'availability_zone': ['compute1', 'compute1'],
+ 'OS_image': ['QTIP_CentOS', 'QTIP_CentOS'],
+ 'public_network': ['admin-floating_net', 'admin-floating_net'],
+ 'flavor': ['m1.large', 'm1.large'],
+ 'role': ['1-server', '2-host']},
+ [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)],
+ {'http_proxy': 'http://10.20.0.1:8118',
+ 'https_proxy': 'http://10.20.0.1:8118',
+ 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}])
+ ])
+ def test_parse_success(self, test_input, expected):
+ print (test_input)
+ print (expected)
+ test_class = Env_setup()
+ benchmark, vm_para, details, proxy = \
+ test_class.parse(test_input)
+ assert benchmark == expected[0]
+ assert vm_para == expected[1]
+ assert sorted(details) == sorted(expected[2])
+ assert proxy == expected[3]
+
+ def test_parse_vm_error(self):
+ test_class = Env_setup()
+ with pytest.raises(KeyError) as excinfo:
+ test_class.parse("tests/test_case/vm_error.yaml")
+ assert "benchmark" in str(excinfo.value)
+
+ def test_update_ansible(self):
+ test_class = Env_setup()
+ test_class.parse("tests/test_case/bm_without_proxy.yaml")
+ test_class.update_ansible()
+ result = filecmp.cmp('tests/output/hosts', 'data/hosts')
+ assert result
+
+ def test_ping(self, capfd):
+ test_class = Env_setup()
+ test_class.parse("tests/test_case/bm_ping.yaml")
+ test_class.call_ping_test()
+ resout, reserr = capfd.readouterr()
+ assert '127.0.0.1 is UP' in resout
diff --git a/tests/fetchimg_test.py b/tests/fetchimg_test.py
new file mode 100644
index 00000000..683c9701
--- /dev/null
+++ b/tests/fetchimg_test.py
@@ -0,0 +1,22 @@
+import mock
+from func.fetchimg import FetchImg
+
+
+class TestClass:
+ @mock.patch('func.fetchimg.os')
+ @mock.patch('func.fetchimg.os.path')
+ def test_fetch_img_success(self, mock_path, mock_os):
+ mock_os.system.return_value = True
+ mock_path.isfile.return_value = True
+ img = FetchImg()
+ img.download()
+
+ @mock.patch('func.fetchimg.time')
+ @mock.patch('func.fetchimg.os.system')
+ @mock.patch('func.fetchimg.os.path')
+ def test_fetch_img_fail(self, mock_path, mock_system, mock_time):
+ img = FetchImg()
+ mock_system.return_value = True
+ mock_path.isfile.side_effect = [False, True]
+ img.download()
+ assert mock_time.sleep.call_count == 2
diff --git a/tests/output/hosts b/tests/output/hosts
new file mode 100644
index 00000000..9b47df0e
--- /dev/null
+++ b/tests/output/hosts
@@ -0,0 +1,3 @@
+[host]
+10.20.0.29
+10.20.0.28
diff --git a/tests/schema/test_bm_schema.yaml b/tests/schema/test_bm_schema.yaml
new file mode 100644
index 00000000..740725f5
--- /dev/null
+++ b/tests/schema/test_bm_schema.yaml
@@ -0,0 +1,75 @@
+type: map
+mapping:
+ Scenario:
+ type: map
+ mapping:
+ benchmark:
+ type: str
+ required: True
+ host:
+ type: str
+ server:
+ type: str
+ allowempty: True
+ client:
+ type: str
+ allowempty: True
+ topology:
+ type: str
+ allowempty: True
+ benchmark_details:
+ type: map
+ mapping:
+ duration:
+ type: int
+ protocol:
+ type: str
+ bandwidthGbps:
+ type: int
+ description:
+ type: str
+ 1Run:
+ type: str
+
+ Context:
+ type: map
+ mapping:
+ Host_Machines:
+ type: map
+ required: True
+ mapping:
+ regex;(^machine):
+ type: map
+ mapping:
+ role:
+ type: str
+ ip:
+ type: str
+ pw:
+ type: str
+ allowempty: True
+ Virtual_Machines:
+ type: map
+ allowempty: True
+ Proxy_Environment:
+ type: map
+ mapping:
+ http_proxy:
+ type: str
+ https_proxy:
+ type: str
+ no_proxy:
+ type: str
+
+ Test_Description:
+ type: map
+ mapping:
+ Test_category:
+ type: str
+ allowempty: True
+ Benchmark:
+ type: str
+ allowempty: True
+ Overview:
+ type: str
+ allowempty: True
diff --git a/tests/schema/test_vm_schema.yaml b/tests/schema/test_vm_schema.yaml
new file mode 100644
index 00000000..524f8fe4
--- /dev/null
+++ b/tests/schema/test_vm_schema.yaml
@@ -0,0 +1,80 @@
+type: map
+mapping:
+ Scenario:
+ type: map
+ mapping:
+ benchmark:
+ type: str
+ required: True
+ host:
+ type: str
+ server:
+ type: str
+ allowempty: True
+ 1Run:
+ type: str
+ client:
+ type: str
+ allowempty: True
+ topology:
+ type: str
+ allowempty: True
+ benchmark_details:
+ type: map
+ mapping:
+ duration:
+ type: int
+ protocol:
+ type: str
+ bandwidthGbps:
+ type: int
+ teststream:
+ type: str
+ description:
+ type: str
+
+ Context:
+ type: map
+ mapping:
+ Host_Machines:
+ type: map
+ allowempty: True
+ Virtual_Machines:
+ type: map
+ required: True
+ mapping:
+ regex;(^virtualmachine):
+ type: map
+ mapping:
+ availability_zone:
+ type: str
+ OS_image:
+ type: str
+ public_network:
+ type: str
+ role:
+ type: str
+ flavor:
+ type: str
+ Proxy_Environment:
+ type: map
+ mapping:
+ http_proxy:
+ type: str
+ https_proxy:
+ type: str
+ no_proxy:
+ type: str
+
+ Test_Description:
+ type: map
+ mapping:
+ Test_category:
+ type: str
+ allowempty: True
+ Benchmark:
+ type: str
+ allowempty: True
+ Overview:
+ type: str
+ allowempty: True
diff --git a/tests/spawn_vm_test.py b/tests/spawn_vm_test.py
new file mode 100644
index 00000000..eb843ad9
--- /dev/null
+++ b/tests/spawn_vm_test.py
@@ -0,0 +1,71 @@
+import pytest
+import mock
+from mock import Mock, MagicMock
+import os
+from func.spawn_vm import SpawnVM
+
+
+class KeystoneMock(MagicMock):
+ auth_token = Mock()
+ v2_0 = Mock()
+
+
+class ImageMock(MagicMock):
+ name = 'QTIP_CentOS'
+
+
+class ImagesMock(MagicMock):
+ def list(self):
+ return [ImageMock()]
+
+
+class StackMock(MagicMock):
+ status = 'COMPLETE'
+ outputs = [{'output_key': 'availability_instance_1',
+ 'output_value': 'output_value_1'},
+ {'output_key': 'instance_ip_1',
+ "output_value": "172.10.0.154"},
+ {"output_key": "instance_PIP_1",
+ "output_value": "10.10.17.5"},
+ {'output_key': 'KeyPair_PublicKey',
+ "output_value": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpwIBAAKCAQEAqCiHcrLBXtxG0LhnKndU7VIVpYxORmv0d4tvujkWOkYuagiW\nU/MTRk0zhRvFQDVPEs0Jrj/BIecqm6fjjT6dZ/H7JLYGaqJitRkoupKgBsMSIqUz\nrR0ekOlfXZ6N+Ud8k6s+qjc7BO4b1ezz78jHisC5o0GCkUV0ECx64Re1fO+oKs1c\nfL9aaexahJUYN3J48pazQz+imc2x/G9nuqHX3cqEszmxnT4jwv//In1GjHy2AyXw\n1oA5F6wZoQCSrXc2BditU+1tlVhEkPFt5JgiHUpY8T8mYbroT7JH6xjcGSKUN+HG\nN8PXNUTD1VAQfwHpkfsGMfDyzjytCXsoTEOqnwIDAQABAoIBAAEL/4vfQQTuKiKy\ngzHofEbd8/SL4xDdKzBzVca7BEBon3FZjFYJdV1CrcduXNQBgPSFAkJrczBa2BEQ\nAoKmmSREhWO9Hl0blbG67l36+7QPEtXUYXX6cG5Ghal3izq6DzR8JG+62Es3kETM\nrNgZT+S1PnKdvcpZvFc9b6ZnF2InuTbrmNVBZKrhdWOJ5tCwRGKKUl6BHoJH3yu0\nT5hUW277e1LYHx+hZtoZ98ToC+LGe6/M8a8y6VLYpcQlX2AtVXeGDalomunF+p3f\nuY6din6s4lq1gSJz03PTpUbwiuhYCTe8Xkseu74Y+XYYJXPHopFju0Ewd6p0Db9Q\nJzzxCoECggCBAM2ox9zyrDc/Vlc0bb9SciFGUd/nEJF89+UHy98bAkpo22zNZIDg\nfacSgkg/6faZD+KrOU0I5W7m2B5t6w2fNHHik6NYGSLQ1JhgbXELGV7X/qECDL02\nctPaf+8o+dYoZja2LdJNASq2nmEmPI3LSHhzAt4dWY4W+geXiHt4iWVHAoIAgQDR\nUdN09xv4U+stWqNcSfgjtx6boEUE8Ky7pyj+LrZKG0L61Jy9cSDP0x0rCtkW9vVR\n6RjidWM/DHQ5cl6aq+7pPy20/OqtqttFYT4R+C3AoAnRSaNzPD9a80C2gjv7WEz0\nPPFstWkI1gsN71KKRx7e6NIa9CNn5x9iE+SGfjgb6QKCAIBXylzG7LCnRNpOj4rp\nyP//RE1fDvv7nyUTF6jnrFfl+6zvXR4yBaKd10DWJrJxGhW15PGo+Ms39EL9el6E\nihmRI+9yIwFX411dToxpXRuPaRTBFmbpvnx2Ayfpp8w+pzA62rnktApzeVFSl0fy\nH3zoLfBjcJPyG8zPwNf6HRJJsQKCAIAE2S5asTaWo+r4m/bYtmXm/eDZnfa7TI/T\nsOWELbTPNp5wjOgsgyhNaAhu7MtmesXn5cxLwohP94vhoMKMNptMD8iRPqJ471Iw\n4zW62NLGeW6AyIHes3CMPMIs+AtHoR33MkotSG5sY/jRk8+HoGoYo6/qK+l+CJ5z\neR579wR5sQKCAIAvPWq+bvcPTDKUU1Fe/Y/GyWoUA+uSqmCdORBkK38lALFGphxj\nfDz9dXskimqW+A9hOPOS8dm8YcVvi/TLXVE5Vsx9VkOg6z6AZBQpgNXGfOgpju4W\nbjER7bQaASatuWQyCxbA9oNlAUdSeOhGTxeFLkLj7hNMd6tLjfd8w7A/hA==\n-----END RSA PRIVATE KEY-----\n"}]
+
+
+class HeatMock(MagicMock):
+ def list(self):
+ return []
+
+ def get(self, stackname):
+ return StackMock()
+
+ def create(self, stack_name, template):
+ pass
+
+
+class TestClass:
+ @pytest.mark.parametrize("test_input, expected", [
+ ({'availability_zone': ['compute1', 'compute1'],
+ 'OS_image': ['QTIP_CentOS', 'QTIP_CentOS'],
+ 'public_network': ['admin-floating_net', 'admin-floating_net'],
+ 'flavor': ['m1.large', 'm1.large'],
+ 'role': ['1-server', '2-host']},
+ [('172.10.0.154', '')]),
+ ])
+ @mock.patch('func.spawn_vm.Env_setup')
+ @mock.patch('func.spawn_vm.FetchImg')
+ @mock.patch('func.spawn_vm.create_zones')
+ @mock.patch('func.spawn_vm.client', autospec=True)
+ @mock.patch('func.spawn_vm.glanceclient', autospec=True)
+ @mock.patch('func.spawn_vm.keystoneclient.v2_0', autospec=True)
+ @mock.patch('func.spawn_vm.heatclient.client', autospec=True)
+ def test_create_zones_success(self, mock_heat, mock_keystone, mock_glance,
+ mock_nova_client, mock_zone, mock_fetch,
+ mock_setup, test_input, expected):
+ mock_glance.Client.return_value = Mock(images=ImagesMock())
+ mock_nova_client.Client.return_value = Mock()
+ mock_heat.Client.return_value = Mock(stacks=HeatMock())
+ k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel'})
+ k.start()
+ SpawnVM(test_input)
+ k.stop()
+ mock_setup.ip_pw_list.append.assert_called_with(expected[0])
diff --git a/tests/test_case/bm_ping.yaml b/tests/test_case/bm_ping.yaml
new file mode 100644
index 00000000..41d696e2
--- /dev/null
+++ b/tests/test_case/bm_ping.yaml
@@ -0,0 +1,29 @@
+
+Scenario:
+ benchmark: dhrystone
+ host: machine_1
+ server:
+
+Context:
+ Host_Machines:
+ machine_1:
+ ip: 127.0.0.1
+ pw:
+ role: host
+
+ Virtual_Machines:
+
+
+Test_Description:
+ Test_category: "Compute"
+ Benchmark: "dhrystone"
+ Overview: >
+ ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
+ if you wish to add a virtual machine add the following information under the Virtual_Machine tag
+
+ virtualmachine_1:
+ availability_zone:
+ public_network:
+ OS_image:
+ flavor:
+ role: '''
diff --git a/tests/test_case/bm_with_proxy.yaml b/tests/test_case/bm_with_proxy.yaml
new file mode 100644
index 00000000..1d73300b
--- /dev/null
+++ b/tests/test_case/bm_with_proxy.yaml
@@ -0,0 +1,39 @@
+
+Scenario:
+ benchmark: dhrystone
+ host: machine_1, machine_2
+ server:
+
+Context:
+ Host_Machines:
+ machine_1:
+ ip: 10.20.0.28
+ pw:
+ role: host
+ machine_2:
+ ip: 10.20.0.29
+ pw:
+ role: host
+
+ Virtual_Machines:
+
+ Proxy_Environment:
+ http_proxy: http://10.20.0.1:8118
+ https_proxy: http://10.20.0.1:8118
+ no_proxy: localhost,127.0.0.1,10.20.*,192.168.*
+
+
+
+Test_Description:
+ Test_category: "Compute"
+ Benchmark: "dhrystone"
+ Overview: >
+ ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
+ if you wish to add a virtual machine add the following information under the Virtual_Machine tag
+
+ virtualmachine_1:
+ availability_zone:
+ public_network:
+ OS_image:
+ flavor:
+ role: '''
diff --git a/tests/test_case/bm_without_proxy.yaml b/tests/test_case/bm_without_proxy.yaml
new file mode 100644
index 00000000..a9ae3b71
--- /dev/null
+++ b/tests/test_case/bm_without_proxy.yaml
@@ -0,0 +1,33 @@
+
+Scenario:
+ benchmark: dhrystone
+ host: machine_1, machine_2
+ server:
+
+Context:
+ Host_Machines:
+ machine_1:
+ ip: 10.20.0.28
+ pw:
+ role: host
+ machine_2:
+ ip: 10.20.0.29
+ pw:
+ role: host
+
+ Virtual_Machines:
+
+
+Test_Description:
+ Test_category: "Compute"
+ Benchmark: "dhrystone"
+ Overview: >
+ ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
+ if you wish to add a virtual machine add the following information under the Virtual_Machine tag
+
+ virtualmachine_1:
+ availability_zone:
+ public_network:
+ OS_image:
+ flavor:
+ role: '''
diff --git a/tests/test_case/vm.yaml b/tests/test_case/vm.yaml
new file mode 100644
index 00000000..4c8453ca
--- /dev/null
+++ b/tests/test_case/vm.yaml
@@ -0,0 +1,48 @@
+Scenario:
+ benchmark: iperf
+ topology: Client and Server on ONE compute
+ server : virtualmachine_1
+ client: virtualmachine_2
+ description: 'Leave the bandwidth as 0 to throttle maximum traffic'
+ benchmark_details:
+ duration: 20
+ protocol: tcp
+ bandwidthGbps: 0
+
+Context:
+ Host_Machines:
+
+ Virtual_Machines:
+ virtualmachine_1:
+ availability_zone: compute1
+ OS_image: QTIP_CentOS
+ public_network: 'admin-floating_net'
+ role: 1-server
+ flavor: m1.large
+
+ virtualmachine_2:
+ availability_zone: compute1
+ OS_image: QTIP_CentOS
+ public_network: 'admin-floating_net'
+ role: 2-host
+ flavor: m1.large
+
+ Proxy_Environment:
+ http_proxy: http://10.20.0.1:8118
+ https_proxy: http://10.20.0.1:8118
+ no_proxy: localhost,127.0.0.1,10.20.*,192.168.*
+
+Test_Description:
+ Test_category: "network"
+ Benchmark: "iperf"
+ Overview: >
+ '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n
+ same compute node
+ if you wish to add a host machine add the following information under the Host_Machine tag
+
+ machine_1:
+ ip:
+ pw:
+ role:
+ '''
+
diff --git a/tests/test_case/vm_error.yaml b/tests/test_case/vm_error.yaml
new file mode 100644
index 00000000..f13d3a00
--- /dev/null
+++ b/tests/test_case/vm_error.yaml
@@ -0,0 +1,42 @@
+Scenario:
+ topology: Client and Server on ONE compute
+ server : virtualmachine_1
+ client: virtualmachine_2
+ description: 'Leave the bandwidth as 0 to throttle maximum traffic'
+ benchmark_details:
+ duration: 20
+ protocol: tcp
+ bandwidthGbps: 0
+
+Context:
+ Host_Machines:
+
+ Virtual_Machines:
+ virtualmachine_1:
+ availability_zone: compute1
+ OS_image: QTIP_CentOS
+ public_network: 'admin-floating_net'
+ role: 1-server
+ flavor: m1.large
+
+ virtualmachine_2:
+ availability_zone: compute1
+ OS_image: QTIP_CentOS
+ public_network: 'admin-floating_net'
+ role: 2-host
+ flavor: m1.large
+
+Test_Description:
+ Test_category: "network"
+ Benchmark: "iperf"
+ Overview: >
+ '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n
+ same compute node
+ if you wish to add a host machine add the following information under the Host_Machine tag
+
+ machine_1:
+ ip:
+ pw:
+ role:
+ '''
+
diff --git a/tests/yaml_schema_test.py b/tests/yaml_schema_test.py
new file mode 100644
index 00000000..a975dca6
--- /dev/null
+++ b/tests/yaml_schema_test.py
@@ -0,0 +1,16 @@
+import os
+import os.path
+from pykwalify.core import Core
+
+
+class TestClass:
+ def test_schema_success(self):
+ for root, dirs, files in os.walk("test_cases"):
+ for name in files:
+ print root + "/" + name
+ if "_bm" in name:
+ schema = "tests/schema/test_bm_schema.yaml"
+ if "_vm" in name:
+ schema = "tests/schema/test_vm_schema.yaml"
+ c = Core(source_file=root + "/" + name, schema_files=[schema])
+ c.validate(raise_exception=True)