From 1375b85cba701a0d0044ca1a1e65ca162a3a749c Mon Sep 17 00:00:00 2001 From: Meghann Cunningham Date: Wed, 11 Jan 2023 13:02:46 -0600 Subject: [PATCH] fixes saltstack/salt#63463 add JUnit output for saltcheck --- changelog/63463.added | 1 + tests/pytests/unit/modules/test_saltcheck.py | 23 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 changelog/63463.added diff --git a/changelog/63463.added b/changelog/63463.added new file mode 100644 index 00000000000..0592bf74a7d --- /dev/null +++ b/changelog/63463.added @@ -0,0 +1 @@ +add JUnit output for saltcheck diff --git a/tests/pytests/unit/modules/test_saltcheck.py b/tests/pytests/unit/modules/test_saltcheck.py index 18afc10cabe..b8574cea8cb 100644 --- a/tests/pytests/unit/modules/test_saltcheck.py +++ b/tests/pytests/unit/modules/test_saltcheck.py @@ -16,5 +16,26 @@ def test__get_top_states_call_args(saltenv): def test__generate_junit_out_list(): - results = {} + results = { + "apache": { + "echo_test_hello": {"status": "Pass", "duration": 2.5907}, + "echo_test_hello2": { + "status": "Fail: fail expected is not equal to hello", + "duration": 0.4503, + }, + "echo_test_hello3": {"status": "Skip", "duration": 0.0}, + } + } + + expected = ( + """\n\n""" + + """\t\n""" + + """\t\t\n""" + + """\t\t\n""" + + """\t\t\t\n\t\t\n""" + + """\t\t\n\t\t\t\n\t\t\n""" + + """\t\n\n""" + ) + ret = saltcheck._generate_junit_out_list(results) + assert ret == expected