Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Override uId and gId for Tar in test #264

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.codehaus.plexus.archiver.exceptions.EmptyArchiveException;
import org.codehaus.plexus.archiver.tar.TarArchiver;
import org.codehaus.plexus.archiver.tar.TarFile;
import org.codehaus.plexus.archiver.tar.TarLongFileMode;
import org.codehaus.plexus.archiver.util.ArchiveEntryUtils;
import org.codehaus.plexus.archiver.util.DefaultArchivedFileSet;
import org.codehaus.plexus.archiver.util.DefaultFileSet;
Expand Down Expand Up @@ -809,6 +810,10 @@ public void testZipNonConcurrentResourceCollection()
{
final File tarFile = getTestFile( "target/output/zip-non-concurrent.tar" );
TarArchiver tarArchiver = (TarArchiver) lookup( Archiver.class, "tar" );
// Override uId and gId - in standard mode on OS where uId or gId can have long values creation of tar can fail
// We can not use posix mode because mTime can have nanoseconds in posix but zip doesn't so assertions can fail
tarArchiver.setOverrideUid(100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests the zip file creation from resource collection so not getting the uid/gui from the filesystem should not affect what is asserted. But I wonder how tar tests are not failing then. They should test if the uid is correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In tar tests posix mode is used.

But here also timestamp is compared. Looks like in zip nanoseconds are dropped.

tarArchiver.setOverrideGid(100);
tarArchiver.setDestFile( tarFile );
// We're testing concurrency issue so we need large amount of files
for ( int i = 0; i < 100; i++ )
Expand Down