Mitigating for missing values in storage QPI. 51/41151/2
authorTaseer Ahmed <taseer94@gmail.com>
Wed, 6 Sep 2017 07:15:22 +0000 (12:15 +0500)
committerTaseer Ahmed <taseer94@gmail.com>
Thu, 7 Sep 2017 05:34:01 +0000 (10:34 +0500)
- Update unit tests

Change-Id: I7bfe89dc6bbe1cafe13b2f3e4f9356a06a59c68b
Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
qtip/cli/commands/cmd_qpi.py
tests/unit/cli/cmd_qpi_test.py

index 4865b7a..a280203 100644 (file)
@@ -44,6 +44,10 @@ def show(name):
     with open('{}/{}.yaml'.format(QPI_PATH, name)) as conf:
         qpi = yaml.safe_load(conf)
     for section in qpi['sections']:
-        table.add_row([section['name'], section['description'],
-                       section['formula']])
+        try:
+            table.add_row([section['name'], section['description'],
+                           section['formula']])
+        except Exception:
+            table.add_row([section['name'], section['description'],
+                           'Not Available'])
     click.echo(table)
index ba5f814..fa0c859 100644 (file)
@@ -26,8 +26,11 @@ def test_list(runner):
     assert 'QTIP Performance Index of compute' in result.output
 
 
-def test_show(runner):
-    result = runner.invoke(cli, ['qpi', 'show', 'compute'])
+@pytest.mark.parametrize("test_input", [
+    'storage',
+    'compute'])
+def test_show(runner, test_input):
+    result = runner.invoke(cli, ['qpi', 'show', test_input])
     assert 'QPI' in result.output
     assert 'Description' in result.output
     assert 'Formula' in result.output