From 082eb9275cd35bb9808851595e9a9fb0e0ed526c Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Tue, 21 Nov 2023 22:01:23 +0530 Subject: [PATCH] test.sit-test-cases: Redirect test output to a file 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 --- .../ansible/roles/test.sit-test-cases/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/ansible/roles/test.sit-test-cases/tasks/main.yml b/playbooks/ansible/roles/test.sit-test-cases/tasks/main.yml index 7517604a..9af46ea7 100644 --- a/playbooks/ansible/roles/test.sit-test-cases/tasks/main.yml +++ b/playbooks/ansible/roles/test.sit-test-cases/tasks/main.yml @@ -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