Merge "create an empty test job during the test"
diff --git a/cvp_checks/fixtures/base.py b/cvp_checks/fixtures/base.py
index f64c256..f6ad22a 100644
--- a/cvp_checks/fixtures/base.py
+++ b/cvp_checks/fixtures/base.py
@@ -1,4 +1,5 @@
import pytest
+import atexit
import cvp_checks.utils as utils
@@ -64,3 +65,47 @@
if len(versions) != 1:
pytest.fail('Contrail versions are not the same: {}'.format(probe))
pytest.contrail = str(versions.pop())[:1]
+
+
+@pytest.fixture(autouse=True, scope='session')
+def print_node_version(local_salt_client):
+ """
+ Gets info about each node using salt command, info is represented as a dictionary with :
+ {node_name1: output1, node_name2: ...}
+
+ :print to output the table with results after completing all tests if nodes and salt output exist.
+ Prints nothing otherwise
+ :return None
+ """
+ try:
+ filename_with_versions = "/etc/image_version"
+ cat_image_version_file = "if [ -f '{name}' ]; then \
+ cat {name}; \
+ else \
+ echo BUILD_TIMESTAMP='no {name}'; \
+ echo BUILD_TIMESTAMP_RFC='no {name}'; \
+ fi ".format(name=filename_with_versions)
+
+ list_version = local_salt_client.cmd(
+ '*',
+ 'cmd.run',
+ 'echo "NODE_INFO=$(uname -sr)" && ' + cat_image_version_file,
+ expr_form='compound')
+ if list_version.__len__() == 0:
+ yield
+ parsed = {k: v.split('\n') for k, v in list_version.items()}
+ columns = [name.split('=')[0] for name in parsed.values()[0]]
+
+ template = "{:<40} | {:<25} | {:<25} | {:<25}\n"
+
+ report_text = template.format("NODE", *columns)
+ for node, data in sorted(parsed.items()):
+ report_text += template.format(node, *[item.split("=")[1] for item in data])
+
+ def write_report():
+ print(report_text)
+ atexit.register(write_report)
+ yield
+ except Exception as e:
+ print("print_node_version:: some error occurred: {}".format(e))
+ yield
diff --git a/cvp_checks/tests/test_ui_addresses.py b/cvp_checks/tests/test_ui_addresses.py
index 15c9068..82bcae1 100644
--- a/cvp_checks/tests/test_ui_addresses.py
+++ b/cvp_checks/tests/test_ui_addresses.py
@@ -8,6 +8,8 @@
'pillar.get',
['_param:cluster_public_host'],
expr_form='pillar')
+ if not salt_output:
+ pytest.skip("Horizon is not enabled on this environment")
IP = [salt_output[node] for node in salt_output
if salt_output[node]]
result = local_salt_client.cmd(