summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-07-24 17:21:18 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-07-27 13:41:26 +0900
commit0a7cfcdfdd71885a404e780027893e3ab9be4b84 (patch)
tree5b5d99a9b57f439e01e810f49303ec3a30153020
parentca224425cfe281b4940fd8f84d50c0ec77cb7fad (diff)
downloadbuildstream-0a7cfcdfdd71885a404e780027893e3ab9be4b84.tar.gz
tests/sources: deb, tar and zip all test for retry behaviour
This is following 5d6418a06a3a0262df5f6b9e6e1a36578515fd4a where DownloadableFileSource was modified to raise 'temporary' errors when relating to file downloading.
-rw-r--r--tests/sources/deb.py3
-rw-r--r--tests/sources/tar.py3
-rw-r--r--tests/sources/zip.py3
3 files changed, 6 insertions, 3 deletions
diff --git a/tests/sources/deb.py b/tests/sources/deb.py
index 7bd99c22d..9df0dadf0 100644
--- a/tests/sources/deb.py
+++ b/tests/sources/deb.py
@@ -45,7 +45,7 @@ def test_no_ref(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'target.bst') == 'no reference'
-# Test that when I fetch a nonexistent URL, errors are handled gracefully.
+# Test that when I fetch a nonexistent URL, errors are handled gracefully and a retry is performed.
@pytest.mark.skipif(HAVE_ARPY is False, reason="arpy is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
def test_fetch_bad_url(cli, tmpdir, datafiles):
@@ -56,6 +56,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles):
result = cli.run(project=project, args=[
'fetch', 'target.bst'
])
+ assert "Try #" in result.stderr
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index 556b12f31..fb02de306 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -56,7 +56,7 @@ def test_no_ref(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'target.bst') == 'no reference'
-# Test that when I fetch a nonexistent URL, errors are handled gracefully.
+# Test that when I fetch a nonexistent URL, errors are handled gracefully and a retry is performed.
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
def test_fetch_bad_url(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -66,6 +66,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles):
result = cli.run(project=project, args=[
'fetch', 'target.bst'
])
+ assert "Try #" in result.stderr
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)
diff --git a/tests/sources/zip.py b/tests/sources/zip.py
index 200dafcaa..a168d529b 100644
--- a/tests/sources/zip.py
+++ b/tests/sources/zip.py
@@ -43,7 +43,7 @@ def test_no_ref(cli, tmpdir, datafiles):
assert cli.get_element_state(project, 'target.bst') == 'no reference'
-# Test that when I fetch a nonexistent URL, errors are handled gracefully.
+# Test that when I fetch a nonexistent URL, errors are handled gracefully and a retry is performed.
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
def test_fetch_bad_url(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -53,6 +53,7 @@ def test_fetch_bad_url(cli, tmpdir, datafiles):
result = cli.run(project=project, args=[
'fetch', 'target.bst'
])
+ assert "Try #" in result.stderr
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)