summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ci/run_ci.sh4
-rw-r--r--tests/data/results/expected.json16
-rw-r--r--tests/unit/ansible_library/plugins/action/calculate_test.py24
-rw-r--r--tests/unit/cli/cmd_plan_test.py43
4 files changed, 30 insertions, 57 deletions
diff --git a/tests/ci/run_ci.sh b/tests/ci/run_ci.sh
index 8fd53b36..fa2f2e34 100644
--- a/tests/ci/run_ci.sh
+++ b/tests/ci/run_ci.sh
@@ -45,6 +45,8 @@ done
#set vars from env if not provided by user as options
installer_type=${installer_type:-$INSTALLER_TYPE}
installer_ip=${installer_ip:-$INSTALLER_IP}
+pod_name=${pod_name:-$POD_NAME}
+scenario=${scenario:-$SCENARIO}
sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
@@ -65,7 +67,7 @@ esac
cd /home/opnfv
-qtip workspace create --pod ${pod_name} --installer ${installer_type} \
+qtip create --template compute --pod ${pod_name} --installer ${installer_type} \
--master-host ${installer_ip} --scenario ${scenario} workspace
cd /home/opnfv/workspace/
diff --git a/tests/data/results/expected.json b/tests/data/results/expected.json
index a495d999..e77200d4 100644
--- a/tests/data/results/expected.json
+++ b/tests/data/results/expected.json
@@ -1,7 +1,15 @@
{
"score": 150,
- "host_results": [
- {"host": "host1", "result": {"score": 100}},
- {"host": "host2", "result": {"score": 200}}
- ]
+ "children": [
+ {
+ "name": "host1",
+ "score": 100
+ },
+ {
+ "name": "host2",
+ "score": 200
+ }
+ ],
+ "description": "POD Compute QPI",
+ "name": "compute"
}
diff --git a/tests/unit/ansible_library/plugins/action/calculate_test.py b/tests/unit/ansible_library/plugins/action/calculate_test.py
index 68a03e2a..fae59821 100644
--- a/tests/unit/ansible_library/plugins/action/calculate_test.py
+++ b/tests/unit/ansible_library/plugins/action/calculate_test.py
@@ -45,8 +45,8 @@ def section_spec(metric_spec):
@pytest.fixture
def qpi_spec(section_spec):
return {
- "description": "QTIP Performance Index of compute",
"name": "compute",
+ "description": "QTIP Performance Index of compute",
"sections": [section_spec]
}
@@ -54,23 +54,29 @@ def qpi_spec(section_spec):
@pytest.fixture()
def metric_result():
return {'score': 1.0,
- 'workload_results': [
- {'name': 'rsa_sign', 'score': 1.0},
- {'name': 'rsa_verify', 'score': 1.0}]}
+ 'name': 'ssl_rsa',
+ 'description': 'metric',
+ 'children': [{'description': 'workload', 'name': 'rsa_sign', 'score': 1.0},
+ {'description': 'workload', 'name': 'rsa_verify', 'score': 1.0}]}
@pytest.fixture()
def section_result(metric_result):
return {'score': 1.0,
- 'metric_results': [{'name': 'ssl_rsa', 'result': metric_result}]}
+ 'name': 'ssl',
+ 'description': 'cryptography and SSL/TLS performance',
+ 'children': [metric_result]}
@pytest.fixture()
-def qpi_result(qpi_spec, section_result, metrics):
+def qpi_result(section_result, metrics):
return {'score': 2048,
- 'spec': qpi_spec,
- 'metrics': metrics,
- 'section_results': [{'name': 'ssl', 'result': section_result}]}
+ 'name': 'compute',
+ 'description': 'QTIP Performance Index of compute',
+ 'children': [section_result],
+ 'details': {
+ 'spec': "https://git.opnfv.org/qtip/tree/resources/QPI/compute.yaml",
+ 'metrics': metrics}}
def test_calc_metric(metric_spec, metrics, metric_result):
diff --git a/tests/unit/cli/cmd_plan_test.py b/tests/unit/cli/cmd_plan_test.py
deleted file mode 100644
index 53a04800..00000000
--- a/tests/unit/cli/cmd_plan_test.py
+++ /dev/null
@@ -1,43 +0,0 @@
-###############################################################
-# Copyright (c) 2017 taseer94@gmail.com 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
-##############################################################################
-
-import pytest
-from click.testing import CliRunner
-
-from qtip.cli.entry import cli
-
-
-@pytest.fixture(scope="module")
-def runner():
- return CliRunner()
-
-
-def test_list(runner):
- result = runner.invoke(cli, ['plan', 'list'])
- assert 'Plan' and 'compute' and 'sample' in result.output
-
-
-def test_run(runner):
- result = runner.invoke(cli, ['plan', 'run', 'fake-plan'])
- assert result.output == ''
-
- result = runner.invoke(cli, ['plan', 'run'])
- assert 'Missing argument "name".' in result.output
-
-
-def test_show(runner):
- result = runner.invoke(cli, ['plan', 'show', 'compute'])
- assert 'Name: compute QPI' in result.output
- assert 'Description: compute QPI profile'
-
- result = runner.invoke(cli, ['plan', 'show'])
- assert 'Missing argument "name".' in result.output
-
- result = runner.invoke(cli, ['plan', 'show', 'xyz'])
- assert "ERROR: plan spec: xyz not found" in result.output