Skip to content

Conversation

@mnonnenmacher
Copy link
Member

@mnonnenmacher mnonnenmacher commented Sep 3, 2024

Check if an archive exists in the storage before trying to read it in FileArchiver.unarchive and FileListResolver.resolve.

This prevents an error message when calling storage.getData() and the data does not exist.

Resolves #7041.

Also fix a bug in XZCompressedFileStorage which was discovered by the change.

@mnonnenmacher mnonnenmacher requested a review from a team as a code owner September 3, 2024 13:48
@mnonnenmacher mnonnenmacher force-pushed the check-if-storage-has-data branch from cdc6586 to 3c53ae0 Compare September 3, 2024 13:49
@codecov
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.42%. Comparing base (4f870c2) to head (bc6785c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
model/src/main/kotlin/utils/FileArchiver.kt 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9071      +/-   ##
============================================
+ Coverage     68.39%   68.42%   +0.03%     
- Complexity     1161     1165       +4     
============================================
  Files           238      238              
  Lines          7648     7646       -2     
  Branches        870      871       +1     
============================================
+ Hits           5231     5232       +1     
+ Misses         2060     2056       -4     
- Partials        357      358       +1     
Flag Coverage Δ
funTest-docker 67.22% <ø> (ø)
funTest-non-docker 34.16% <70.00%> (-0.03%) ⬇️
test 38.17% <10.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mnonnenmacher mnonnenmacher force-pushed the check-if-storage-has-data branch from 3c53ae0 to a5f784d Compare September 3, 2024 16:26
Use the function names instead of a description for consistency with
other tests.

Signed-off-by: Martin Nonnenmacher <[email protected]>
Remove the fallback to read uncompressed files from the
`XZCompressedLocalFileStorage`. The fallback was introduced for backward
compatibility with previously uncompressed storage directories, but the
compressed storage is now the default for several years so that the
fallback can be removed.

Signed-off-by: Martin Nonnenmacher <[email protected]>
The function was only applied to the path argument by the subclass
`XZCompressedLocalFileStorage` which does not override all functions.
This lead to inconsistencies when using `XZCompressedLocalFileStorage`.

For example, `hasData(path)` could return `false` when the file was
actually present, because the implementation in `LocalFileStorage` did
not apply the `transformPath` function.

For the same reason calling `delete` on `XZCompressedFileStorage` never
deleted any files.

Fix this by making sure that `transformFile` is always applied in
`LocalFileStorage` and not applying it in the subclass anymore.

Also add tests for all functions of `XZCompressedFileStorage` based on
the tests for `LocalFileStorage` to ensure that they work as expected.

Signed-off-by: Martin Nonnenmacher <[email protected]>
Check if an archive exists in the storage before trying to read it in
`FileArchiver.unarchive` and `FileListResolver.resolve`.

This prevents an error message when calling `storage.getData()` and the
data does not exist.

Resolves #7041.

Signed-off-by: Martin Nonnenmacher <[email protected]>
@mnonnenmacher mnonnenmacher force-pushed the check-if-storage-has-data branch from a5f784d to bc6785c Compare September 3, 2024 16:28
@sschuberth sschuberth enabled auto-merge (rebase) September 3, 2024 16:42
@sschuberth sschuberth merged commit 29a108a into main Sep 3, 2024
@sschuberth sschuberth deleted the check-if-storage-has-data branch September 3, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileProvenanceFileStorage cannot find file listings

3 participants