Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Filter out known test failures in Ansible test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypoulz committed Jul 16, 2019
1 parent 17d7f43 commit 42e6ae7
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions tests/scripts/rhel-system-roles/ignore-failures.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
qemu-kvm
timesync/tests_ptp_multi.yml
timesync/tests_ptp_single.yml
selinux/tests_all_transitions.yml
6 changes: 5 additions & 1 deletion tests/scripts/rhel-system-roles/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 28 additions & 0 deletions tests/scripts/rhel-system-roles/validate.sh
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 42e6ae7

Please sign in to comment.