summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-04-28 19:52:56 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-04-29 16:16:24 +0200
commit0c1f6d163dacc6dfcc428424558e2bbd88d485b0 (patch)
treee28cf49d852493d2e7ecabceac5699b3f496187a
parentdae8d5ed0fa08a150040148df550a7027f41c30b (diff)
downloadurpmi-0c1f6d163dacc6dfcc428424558e2bbd88d485b0.tar
urpmi-0c1f6d163dacc6dfcc428424558e2bbd88d485b0.tar.gz
urpmi-0c1f6d163dacc6dfcc428424558e2bbd88d485b0.tar.bz2
urpmi-0c1f6d163dacc6dfcc428424558e2bbd88d485b0.tar.xz
urpmi-0c1f6d163dacc6dfcc428424558e2bbd88d485b0.zip
retry if curl failed with timeout
-rw-r--r--NEWS1
-rw-r--r--t/helper.pm17
2 files changed, 17 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 101f130e..90d43419 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@
o disable fsync/fdatasync while running tests
o make it more robust
o make sure simple-httpd is really killed once tests are completed
+ o retry if curl failed with timeout
Version 8.121 - 8 April 2020
diff --git a/t/helper.pm b/t/helper.pm
index c9c2790c..841b57e6 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -8,7 +8,7 @@ use base 'Exporter';
our @EXPORT = qw(need_root_and_prepare need_downloader
are_weak_deps_supported is_mageia
start_httpd httpd_port
- urpmi_addmedia urpmi_removemedia urpmi_update
+ urpmi_addmedia urpmi_addmedia_should_retry urpmi_removemedia urpmi_update
urpm_cmd run_urpm_cmd urpmi_cmd urpmi urpmi_partial test_urpmi_fail urpme
urpmi_cfg set_urpmi_cfg_global_options
set_path system_ system_should_fail
@@ -100,6 +100,10 @@ sub urpmi_addmedia {
my ($para) = @_;
system_(urpm_cmd('urpmi.addmedia --no-verify-rpm') . " $para");
}
+sub urpmi_addmedia_should_retry {
+ my ($para) = @_;
+ system_should_retry(urpm_cmd('urpmi.addmedia --no-verify-rpm') . " $para");
+}
sub urpmi_removemedia {
my ($para) = @_;
system_(urpm_cmd('urpmi.removemedia') . " $para");
@@ -153,6 +157,17 @@ sub system_should_fail {
$? & 127 ? is($? & 127, 0, "should fail nicely but not get killed: $cmd")
: ok($? != 0, "should fail: $cmd");
}
+sub system_should_retry {
+ my ($cmd) = @_;
+ system($cmd);
+ if ($? == 28) {
+ my $nb = 60;
+ warn "curl timeouted (code=28), will retry after $nb seconds\n";
+ sleep($nb);
+ system($cmd);
+ }
+ ok($? == 0, $cmd);
+}
sub check_installed_fullnames {
my (@names) = @_;