Skip to content

Commit

Permalink
Add exponential backoff for network-related calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Aug 8, 2023
1 parent ee43642 commit c4d8ae3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/install/openqa_webui.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sub install_from_repos {
$add_repo = "zypper -n ar -p 95 -f obs://devel:openQA/$repo openQA";
assert_script_run($_) foreach (split /\n/, $add_repo);
my $proxy_pkg = (check_var('OPENQA_WEB_PROXY', 'nginx')) ? 'nginx' : '';
assert_script_run('retry -s 30 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper --no-cd -n in openQA-local-db '.$proxy_pkg.'"', 600);
assert_script_run('retry -e -s 30 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper --no-cd -n in openQA-local-db '.$proxy_pkg.'"', 600);
my $proxy_args = '';
if (my $proxy = get_var('OPENQA_WEB_PROXY')) { $proxy_args = "--proxy=$proxy" }
assert_script_run "/usr/share/openqa/script/configure-web-proxy $proxy_args";
Expand All @@ -40,13 +40,13 @@ sub install_from_repos {

sub install_from_git {
assert_script_run($_, 600) foreach (split /\n/, <<~'EOF');
retry -s 30 -- zypper -n in -C 'rubygem(sass)' git-core perl-App-cpanminus perl-Module-CPANfile perl-YAML-LibYAML postgresql-server apache2
retry -e -s 30 -- zypper -n in -C 'rubygem(sass)' git-core perl-App-cpanminus perl-Module-CPANfile perl-YAML-LibYAML postgresql-server apache2
systemctl start postgresql || systemctl status --no-pager postgresql
su - postgres -c 'createuser root'
su - postgres -c 'createdb -O root openqa'
git clone https://github.com/os-autoinst/openQA.git
cd openQA
pkgs=$(for p in $(cpanfile-dump); do echo -n "perl($p) "; done); retry -s 30 -- zypper -n in -C $pkgs
pkgs=$(for p in $(cpanfile-dump); do echo -n "perl($p) "; done); retry -e -s 30 -- zypper -n in -C $pkgs
cpanm -nq --installdeps .
for i in headers proxy proxy_http proxy_wstunnel rewrite ; do a2enmod $i ; done
cp etc/apache2/vhosts.d/openqa-common.inc /etc/apache2/vhosts.d/
Expand Down
2 changes: 1 addition & 1 deletion tests/install/openqa_worker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use utils;
sub run {
diag('worker setup');
disable_packagekit;
assert_script_run('retry -s 30 -r 7 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper --no-cd -n in openQA-worker"', 3800);
assert_script_run('retry -e -s 30 -r 7 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper --no-cd -n in openQA-worker"', 3800);
diag('Login once with fake authentication on openqa webUI to actually create preconfigured API keys for worker authentication');
assert_script_run('curl http://localhost/login');
diag('adding temporary, preconfigured API keys to worker config');
Expand Down
2 changes: 1 addition & 1 deletion tests/install/test_distribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sub run {
# changes within the 10 minutes refresh dead-time applied by default in
# /etc/zypp/zypp.conf so we need to refresh explicitly with retries in
# case of problems.
assert_script_run('retry -s 30 -- sh -c "zypper ref && zypper -n in os-autoinst-distri-opensuse-deps"', 600);
assert_script_run('retry -e -s 30 -- sh -c "zypper ref && zypper -n in os-autoinst-distri-opensuse-deps"', 600);
clear_root_console;
# prepare for next test
enter_cmd 'logout';
Expand Down
2 changes: 1 addition & 1 deletion tests/osautoinst/start_test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z \$job_id ]; then echo "Unable to find a suitable job to clone from o3.
echo "Scenario: $arch-$ttest-NET: \$job_id"
EOF
assert_script_run($_) foreach (split /\n/, $cmd);
assert_script_run("retry -- openqa-clone-job --show-progress --from $openqa_url \$job_id", timeout => 120);
assert_script_run("retry -e -- openqa-clone-job --show-progress --from $openqa_url \$job_id", timeout => 120);
}

sub example_run {
Expand Down

0 comments on commit c4d8ae3

Please sign in to comment.