goss
goss copied to clipboard
Customize name attribute in Junit output report
The following declaration generates the Junit xml report
file:
/etc/hosts:
exists: true
mode: "0644"
owner: root
group: root
filetype: file
This is the output from the Junit xml
<testsuite name="goss" errors="0" tests="5" failures="0" skipped="0" time="0.000" timestamp="2018-01-23T16:45:24Z">
<testcase name="File /etc/hosts exists" time="0.000">
<system-out>File: /etc/hosts: exists: matches expectation: [true]</system-out>
</testcase>
<testcase name="File /etc/hosts mode" time="0.000">
<system-out>File: /etc/hosts: mode: matches expectation: ["0644"]</system-out>
</testcase>
<testcase name="File /etc/hosts owner" time="0.000">
<system-out>File: /etc/hosts: owner: matches expectation: ["root"]</system-out>
</testcase>
<testcase name="File /etc/hosts group" time="0.000">
<system-out>File: /etc/hosts: group: matches expectation: ["root"]</system-out>
</testcase>
<testcase name="File /etc/hosts filetype" time="0.000">
<system-out>File: /etc/hosts: filetype: matches expectation: ["file"]</system-out>
</testcase>
</testsuite>
Would it be possible to customise the name="goss" attribute in the goss
with the hostname of the server where it was run, then it would much easier to identiyf and troubleshoot failing tests
As you can see from below, I am checking openssh-version on several servers, but they give no hints where they were executed.
in my pipeline i use actually
sh "sed -i 's/testsuite name=\"goss\"/testsuite name=\"${name}\"/' ${name}-junit.xml"