From 42e6ae771733935d9ed954a83ee567abd489b91b Mon Sep 17 00:00:00 2001 From: Jeremy Poulin Date: Thu, 11 Jul 2019 12:21:32 -0400 Subject: [PATCH] Filter out known test failures in Ansible test --- Jenkinsfile | 4 +-- .../rhel-system-roles/ignore-failures.txt | 4 +++ tests/scripts/rhel-system-roles/test.sh | 6 +++- tests/scripts/rhel-system-roles/validate.sh | 28 +++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tests/scripts/rhel-system-roles/ignore-failures.txt create mode 100644 tests/scripts/rhel-system-roles/validate.sh diff --git a/Jenkinsfile b/Jenkinsfile index 3885b33..1d62f38 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ properties( [ $class: 'ActiveMQSubscriberProviderData', name: 'Red Hat UMB', - overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.373aa6f4-d6b5-4f20-a4d5-557cee12777b.VirtualTopic.eng.brew.>'], + overrides: [topic: 'Consumer.rh-jenkins-ci-plugin.20a11492-54d6-4843-8894-24bd09c30048.VirtualTopic.eng.brew.>'], selector: 'name = \'ansible\' AND type = \'Tag\' AND tag LIKE \'ansible-%-rhel-%-candidate\'', timeout: null ] @@ -303,7 +303,7 @@ MAQEAPI.v1.runTest( { Exception exception, def host -> def error = "Exception ${exception} occured on ${host.arch}\n" errorMessages += error - if (os == RHEL7 && exception.message.contains('script returned exit code 2')) { + if (exception.message.contains('script returned exit code')) { currentBuild.result = 'UNSTABLE' } else { currentBuild.result = 'FAILURE' diff --git a/tests/scripts/rhel-system-roles/ignore-failures.txt b/tests/scripts/rhel-system-roles/ignore-failures.txt new file mode 100644 index 0000000..941bc1e --- /dev/null +++ b/tests/scripts/rhel-system-roles/ignore-failures.txt @@ -0,0 +1,4 @@ +qemu-kvm +timesync/tests_ptp_multi.yml +timesync/tests_ptp_single.yml +selinux/tests_all_transitions.yml diff --git a/tests/scripts/rhel-system-roles/test.sh b/tests/scripts/rhel-system-roles/test.sh index 7d1c382..0a0bf60 100644 --- a/tests/scripts/rhel-system-roles/test.sh +++ b/tests/scripts/rhel-system-roles/test.sh @@ -97,6 +97,9 @@ fi if [ "$test_type" == "$UPSTREAM_TESTSUITE" ]; then # Update the RAM for the VM to 4096 sed -ie s/2048/4096/ provision.fmf + + # Update reboot timeout for all_transistions + # sed -ie "s/timeout: 300/timeout: 3600/" /usr/share/ansible/roles/rhel-system-roles.selinux/tests/selinux_apply_reboot.yml fi # Define output @@ -108,7 +111,8 @@ mkdir -p $output_dir sudo make &> $output_file run # Ensure Success and Restore Directory -grep "OVERALL RESULT" $output_file | grep "PASS" +grep "OVERALL RESULT" $output_file | grep "PASS" || + . $workdir/validate.sh; test_success $output_file $workdir/ignore-failures.txt test_status=$? # Copy ansible logs from tmp diff --git a/tests/scripts/rhel-system-roles/validate.sh b/tests/scripts/rhel-system-roles/validate.sh new file mode 100644 index 0000000..af8e52c --- /dev/null +++ b/tests/scripts/rhel-system-roles/validate.sh @@ -0,0 +1,28 @@ +#!/bin/bash +function test_success { + set +x + logfile=$1 + known_problems=$2 + status=0 + while read -u 3 -r line ; do + accepted=1 + while read -u 4 -r acceptable_failure; do + if [ ! -z $acceptable_failure ]; then + echo $line | grep $acceptable_failure > /dev/null + failure_is_acceptable=$? + #echo ' >' $failure_is_acceptable + + [ $accepted -eq 0 ] || [ $failure_is_acceptable -eq 0 ] + accepted=$? + fi + done 4< $known_problems + [ $status -eq 0 ] && [ $accepted -eq 0 ] + status=$? + #echo $status + done 3< <(grep '\[ FAIL \]' $logfile) + final_status=$status + #echo 'final status:' $final_status + + set -x + return $status +}