Skip to content

Commit

Permalink
Tune the frangistan
Browse files Browse the repository at this point in the history
  • Loading branch information
dbutenhof committed Aug 7, 2023
1 parent 10197ae commit 1ee4153
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/pbench/server/cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,12 @@ def create(cls, tarball: Path, controller: "Controller") -> "Tarball":
# and we'll ignore that condition silently.
try:
tarball.unlink(missing_ok=True)
except Exception as e:
controller.logger.error("Error removing staged tarball {}: {}", name, e)
try:
md5_source.unlink(missing_ok=True)
except Exception as e:
controller.logger.error("Error removing staged upload {}: {}", name, e)
controller.logger.error("Error removing staged MD5 {}: {}", name, e)

return cls(destination, controller)

Expand Down
5 changes: 2 additions & 3 deletions lib/pbench/test/unit/server/test_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ def test_duplicate(
(
(".md5", errno.ENOSPC),
(".md5", errno.EEXIST),
(".md5", None),
("", errno.ENOSPC),
("", errno.EACCES),
("", None),
),
)
def test_move_fails(
Expand Down Expand Up @@ -310,9 +312,6 @@ def unlink(self, missing_ok: bool = False):
assert isinstance(e.value, OSError), f"Wanted OSError, got {type(e.value)}"
assert e.value.errno == errno
else:
assert isinstance(
e.value, Exception
), f"Wanted Exception, got {type(e.value)}"
assert str(e.value) == "I broke"
assert src == [source_md5] + ([source_tarball] if allow else [])
assert len(src) == len(dest) == len(ulink) == len(ok) == 2 if allow else 1
Expand Down

0 comments on commit 1ee4153

Please sign in to comment.