-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2023 Red Hat | ||
# | ||
# SPDX-License-Identifier: LGPL-2.0+ | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
# This test will only pass if the host experiences tcp-resets we are doing that by setting: | ||
# sudo iptables -A OUTPUT -p tcp -m statistic --mode random --probability 0.50 -j REJECT --reject-with tcp-reset | ||
# on the VM running this test. | ||
set -euo pipefail | ||
|
||
. $(dirname $0)/libtest.sh | ||
|
||
COMMIT_SIGN="" | ||
if has_gpgme; then | ||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}" | ||
fi | ||
|
||
echo "1..6" | ||
|
||
# pull should fail but retries should be present. | ||
rm ostree-srv httpd repo -rf | ||
setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}" | ||
|
||
pushd ${test_tmpdir} | ||
ostree_repo_init repo --mode=archive | ||
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo | ||
assert_fail ${CMD_PREFIX} ostree --repo=repo pull --mirror origin main 2>err.txt | ||
assert_file_has_content err.txt "Should retry request \(remaining: 3 retries\), due to transient error" | ||
popd | ||
echo "ok retries present after tcp-reset" |