Fix CompressArchiveUtil unit tests - #1211
Conversation
3a0176e to
6c2a060
Compare
Codecov Report
@@ Coverage Diff @@
## master #1211 +/- ##
==========================================
+ Coverage 58% 58.03% +0.02%
==========================================
Files 455 455
Lines 8835 8835
Branches 533 533
==========================================
+ Hits 5125 5127 +2
Misses 3431 3431
+ Partials 279 277 -2
Continue to review full report at Codecov.
|
37426ee to
e143e1d
Compare
|
@KostyaSha This pull request is ready to review. Once it is merged, I will be able to fix and open a MR to fix issue with symlink[1] [1]#532 |
e143e1d to
1f11a5a
Compare
|
In addition to this PR, I have one commit ready which removes the duplicated code (3 times) to create an entry in an archive and one commit fixing the symlink issue (#532). Do you prefer that I I close this PR and open one with all 3 commits or we keep this one open and wait until it is merged to open 2nd PR and so on for the 3rd PR? |
|
needs rebase now |
The tar method's contract is very clear, it creates a tar archive from files in a folder. The unit tests should validate that the tar archive was created and that the content is what it is supposed to be. Same apply to the archiveTARFiles method. Before, in order to validate that the tar archive was created, the unit tests were un-archiving the tar. This is wrong as you end up implicitly testing the extraction code which could be faulty. In addition, the 2 tests for symlinks were not even checking if the extracted file was a symlink, they were only checking if the file or folder were readable. Rewrite the tests to assert directly the content of the archive. Also fix the 2 symlinks tests to make sure the tar preserve them. Fixing the unit tests exposed that CompressArchiveUtil methods do not preserve the symlinks which is a bug. Add @ignore annotation for those tests until the bug is fixed. This change is a preparation change to fix the archive creation to preserve symlinks so add tests to increase archive creation code coverage close to 100%. This will allow to fix the code while making sure no regression are introduced. Related to issue docker-java#532
1f11a5a to
356c209
Compare
Done |
|
Thanks |
The tar method's contract is very clear, it creates a tar archive from
files in a folder. The unit tests should validate that the tar archive
was created and that the content is what it is supposed to be. Same
apply to the archiveTARFiles method.
Before, in order to validate that the tar archive was created, the unit
tests were un-archiving the tar. This is wrong as you end up implicitly
testing the extraction code which could be faulty.
In addition, the 2 tests for symlinks were not even checking if the
extracted file was a symlink, they were only checking if the file or
folder were readable.
Rewrite the tests to assert directly the content of the archive. Also
fix the 2 symlinks tests to make sure the tar preserve them. Fixing the
unit tests exposed that CompressArchiveUtil methods do not preserve the
symlinks which is a bug. Add @ignore annotation for those tests until
the bug is fixed.
This change is a preparation change to fix the archive creation to
preserve symlinks so add tests to increase archive creation code
coverage close to 100%. This will allow to fix the code while making
sure no regression are introduced.
Related to issue #532
This change is