Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix for issue with source_download set to latest #752

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions docs/requirements.txt
4 changes: 2 additions & 2 deletions lib/pavilion/wget.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def update(pav_cfg, url, dest):
# depends on the transfer encoding. It should match for any already
# compressed files, but other data types are frequently compressed.
elif (not (
info.get('ETag') == head_data.get('ETag') or
info.get('ETag') == head_data.get('ETag') and
# If the old content length is the same, it's probably
# unchanged. Probably...
head_data.get('Content-Length') == info.get('Content-Length') or
head_data.get('Content-Length') == info.get('Content-Length') and
# Or if the content length matches the actual size.
head_data.get('Content-Length') == info['size'])):
fetch = True
Expand Down
1 change: 0 additions & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ python3 -m venv <path to your venv>
source <path to your venv>/bin/activate
pip install --upgrade pip
pip install -r test/requirements.txt
pip install -r docs/requirements.txt
```

Then just activate your virtual environment before running tests.
Expand Down
4 changes: 4 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
pylint
matplotlib > 3

# Requirements for building documentation.
sphinx > 4.0
sphinx_rtd_theme >= 1.0.0
24 changes: 19 additions & 5 deletions test/tests/wget_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class TestWGet(PavTestCase):

GET_TARGET = "https://github.com/lanl/Pavilion/raw/master/README.md"
GET_TARGET2 = "https://github.com/lanl/Pavilion/raw/master/RELEASE.txt"
TARGET_HASH = '275fa3c8aeb10d145754388446be1f24bb16fb00'

_logger = logging.getLogger(__file__)
Expand Down Expand Up @@ -73,8 +74,6 @@ def test_update(self):
# It should update the file if the info file isn't there and the
# sizes don't match.
ctime = dest_fn.stat().st_ctime
with dest_fn.open('ab') as dest_file:
dest_file.write(b'a')
info_fn.unlink()
try:
wget.update(self.pav_cfg, self.GET_TARGET, dest_fn)
Expand All @@ -86,7 +85,6 @@ def test_update(self):

# We'll muck up the info file data, to force an update.
db_data = {
'ETag': 'nope',
'Content-Length': '-1'
}
with info_fn.open('w') as info_file:
Expand All @@ -98,5 +96,21 @@ def test_update(self):
new_ctime = dest_fn.stat().st_ctime
self.assertNotEqual(new_ctime, ctime)

dest_fn.stat()
info_fn.stat()
ctime = new_ctime
# Checking if a remote file change forces an update
try:
wget.update(self.pav_cfg, self.GET_TARGET2, dest_fn)
except pavilion.errors.WGetError as err:
self.fail("Failed with: {}".format(err.args[0]))
new_ctime = dest_fn.stat().st_ctime
self.assertNotEqual(new_ctime, ctime)

ctime = new_ctime
# Make sure no updates happen if everything is the same
try:
wget.update(self.pav_cfg, self.GET_TARGET2, dest_fn)
except pavilion.errors.WGetError as err:
self.fail("Failed with: {}".format(err.args[0]))
new_ctime = dest_fn.stat().st_ctime
self.assertEqual(new_ctime, ctime)

Loading