Blame 0172-TEST-99-RPM-retry-dnf-5-times-in-case-http-fails.patch

Harald Hoyer 53404a
From ae69ae9a28f76729c6f54fb586e33abbad2afd7d Mon Sep 17 00:00:00 2001
Harald Hoyer 53404a
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 53404a
Date: Mon, 14 Nov 2016 17:14:30 +0100
Harald Hoyer 53404a
Subject: [PATCH] TEST-99-RPM: retry dnf 5 times in case http fails
Harald Hoyer 53404a
Harald Hoyer 53404a
---
Harald Hoyer 53404a
 test/TEST-99-RPM/test.sh | 55 +++++++++++++++++++++++++-----------------------
Harald Hoyer 53404a
 1 file changed, 29 insertions(+), 26 deletions(-)
Harald Hoyer 53404a
Harald Hoyer 53404a
diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh
Harald Hoyer 53404a
index 345d524..a670b55 100755
Harald Hoyer 53404a
--- a/test/TEST-99-RPM/test.sh
Harald Hoyer 53404a
+++ b/test/TEST-99-RPM/test.sh
Harald Hoyer 53404a
@@ -18,8 +18,8 @@ test_run() {
Harald Hoyer 53404a
     mkdir -p "$rootdir/dev"
Harald Hoyer 53404a
     mkdir -p "$rootdir/boot"
Harald Hoyer 53404a
 
Harald Hoyer 53404a
-trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
Harald Hoyer 53404a
-trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
Harald Hoyer 53404a
+    trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
Harald Hoyer 53404a
+    trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
Harald Hoyer 53404a
 
Harald Hoyer 53404a
     mount --bind /proc "$rootdir/proc"
Harald Hoyer 53404a
     mount --bind /sys "$rootdir/sys"
Harald Hoyer 53404a
@@ -34,27 +34,30 @@ trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umou
Harald Hoyer 53404a
     dnf_or_yum=yum
Harald Hoyer 53404a
     dnf_or_yum_cmd=yum
Harald Hoyer 53404a
     command -v dnf >/dev/null && { dnf_or_yum="dnf"; dnf_or_yum_cmd="dnf --allowerasing"; }
Harald Hoyer 53404a
-    $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever 25 --disablerepo='*' \
Harald Hoyer 53404a
-                --enablerepo=fedora --enablerepo=updates \
Harald Hoyer 53404a
-                install -y \
Harald Hoyer 53404a
-	$dnf_or_yum \
Harald Hoyer 53404a
-	passwd \
Harald Hoyer 53404a
-	rootfiles \
Harald Hoyer 53404a
-	systemd \
Harald Hoyer 53404a
-    systemd-udev \
Harald Hoyer 53404a
-	kernel \
Harald Hoyer 53404a
-	kernel-core \
Harald Hoyer 53404a
-	redhat-release \
Harald Hoyer 53404a
-	device-mapper-multipath \
Harald Hoyer 53404a
-	lvm2 \
Harald Hoyer 53404a
-	mdadm \
Harald Hoyer 53404a
-    bash \
Harald Hoyer 53404a
-    iscsi-initiator-utils \
Harald Hoyer 53404a
-    "$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
-    ${NULL}
Harald Hoyer 53404a
-    #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
-    #"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
-#    ${NULL}
Harald Hoyer 53404a
+    for (( i=0; i < 5 ; i++)); do
Harald Hoyer 53404a
+        $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever 25 --disablerepo='*' \
Harald Hoyer 53404a
+                        --enablerepo=fedora --enablerepo=updates \
Harald Hoyer 53404a
+                        install -y \
Harald Hoyer 53404a
+                        $dnf_or_yum \
Harald Hoyer 53404a
+                        passwd \
Harald Hoyer 53404a
+                        rootfiles \
Harald Hoyer 53404a
+                        systemd \
Harald Hoyer 53404a
+                        systemd-udev \
Harald Hoyer 53404a
+                        kernel \
Harald Hoyer 53404a
+                        kernel-core \
Harald Hoyer 53404a
+                        redhat-release \
Harald Hoyer 53404a
+                        device-mapper-multipath \
Harald Hoyer 53404a
+                        lvm2 \
Harald Hoyer 53404a
+                        mdadm \
Harald Hoyer 53404a
+                        bash \
Harald Hoyer 53404a
+                        iscsi-initiator-utils \
Harald Hoyer 53404a
+                        "$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
+                        ${NULL} || continue
Harald Hoyer 53404a
+        #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
+            #"$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm \
Harald Hoyer 53404a
+            #    ${NULL}
Harald Hoyer 53404a
+    done
Harald Hoyer 53404a
+    (( i < 5 ))
Harald Hoyer 53404a
 
Harald Hoyer 53404a
     cat >"$rootdir"/test.sh <
Harald Hoyer 53404a
 #!/bin/bash
Harald Hoyer 53404a
@@ -87,9 +90,9 @@ EOF
Harald Hoyer 53404a
     chroot "$rootdir" /test.sh || :
Harald Hoyer 53404a
 
Harald Hoyer 53404a
     if [[ -s "$rootdir"/test.output ]]; then
Harald Hoyer 53404a
-	failed=1
Harald Hoyer 53404a
-	echo TEST Failed >&2
Harald Hoyer 53404a
-	cat "$rootdir"/test.output >&2
Harald Hoyer 53404a
+        failed=1
Harald Hoyer 53404a
+        echo TEST Failed >&2
Harald Hoyer 53404a
+        cat "$rootdir"/test.output >&2
Harald Hoyer 53404a
     fi
Harald Hoyer 53404a
 
Harald Hoyer 53404a
     umount "$rootdir/proc"