Skip to content

Commit

Permalink
tests/functional: Fix hash validation
Browse files Browse the repository at this point in the history
The _check() function is supposed to check whether the hash of the
downloaded file matches the expected one. Unfortunately, during the
last rework of this function, the check was accidentally turned into
returning the hash value itself instead of a True/False value,
effectively accepting each hash as valid. Let's do a proper check
again now.

Fixes:05e303210d ("tests/functional/qemu_test: Use Python hashlib ...")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
huth authored and Michael Tokarev committed Oct 4, 2024
1 parent f2a9c31 commit db17daf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/functional/qemu_test/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _check(self, cache_file):
break
hl.update(chunk)

return hl.hexdigest()
return self.hash == hl.hexdigest()

def valid(self):
return self.cache_file.exists() and self._check(self.cache_file)
Expand Down

0 comments on commit db17daf

Please sign in to comment.