Skip to content

Commit

Permalink
test.sit-test-cases: Redirect test output to a file
Browse files Browse the repository at this point in the history
Instead of cluttering the jenkins job console output with detailed test
results we could redirect everything to a separate file and make it
available as artifacts for each job. Simplest way to achieve this
redirection is to make use of '&>'[1] to include both STDOUT and STDERR.
Location of such an output file is chosen to be under /var/log so that
it also gets collected as part of statedump process.

[1] https://www.gnu.org/software/bash/manual/html_node/Redirections.html(3.6.4)

Signed-off-by: Anoop C S <[email protected]>
  • Loading branch information
anoopcs9 committed Nov 23, 2023
1 parent 50c5915 commit 082eb92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions playbooks/ansible/roles/test.sit-test-cases/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
- name: Run tests
block:
- command:
- shell:
chdir: /root/sit-test-cases
cmd: make test
cmd: make test &> /var/log/test.out
register: test_output
- debug: var=test_output.stdout_lines
when: test_sanity_only is undefined

- name: Run sanity tests
block:
- command:
- shell:
chdir: /root/sit-test-cases
cmd: make sanity_test
cmd: make sanity_test &> /var/log/test.out
register: test_output
- debug: var=test_output.stdout_lines
when: test_sanity_only is defined

0 comments on commit 082eb92

Please sign in to comment.