Repository navigation
Use temporary folders in tests and smoke test message export archives - #579
Open
tonygermano wants to merge 3 commits into
Open
tonygermano wants to merge 3 commits into
tonygermano wants to merge 3 commits into
Conversation
Nothing exercises message export to an archive against a running server or the packaged distribution. The unit tests run on the build classpath, so a library missing from the distribution, or one that misbehaves in it, would go unnoticed until someone exported messages. Add a smoke test that sends a few messages through a channel and exports them the way the administrator's export dialog does: - Locally, in the harness JVM, which runs with the engine's own jars: an unencrypted ZIP, a gzipped TAR, and a ZIP for each encryption type. The archives are checked with the JDK and commons-compress, not the ZIP library under test, so the test holds when that library is upgraded. For the encrypted ones it checks that the JDK refuses to open the archive, that every entry name is in the directory, and that the WinZip AES record is present exactly when AES was asked for. - On the server, a password protected ZIP. The harness cannot read the server's file system, so this checks that the export completes and counts the messages, which fails if the library cannot be loaded or the archive cannot be finished. The test passes against the current zip4j 1.3.3. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Tony Germano <tony@germano.name>
…d /tmp Several tests created files outside a managed directory: - DefaultExtensionControllerTest and ArchiveUtilsTest extracted into tests/zipextraction relative to the working directory, with an @after that only deleted top-level files, and created their zip fixtures in the system temp directory without removing them. - XsltStepTest left its resource-library directory behind, because deleteOnExit cannot remove a directory that is not empty. - FileConnectionTests used a TEST_FileConnection folder in the working directory, and Log4jMigrationsTest, Log4jBootstrapTest and XMLBatchAdaptorTest relied on deleteOnExit for files in the system temp directory. Use a JUnit TemporaryFolder in all of them so everything is removed after each test, and use java.nio.file for the files the tests create, read and write themselves. Calls that need a java.io.File, such as the production APIs under test and File.setReadable, keep it. The zip extraction directory is a subfolder of the temporary folder so that the "../" zip-slip entries still resolve inside it. FileConnectionTests stays on java.io.File to keep its diff small. Besides moving its folder to the rule, it restores the read and write permissions that some tests remove so the rule can delete the folder, and testReadFile now closes its stream with try-with-resources and lets a FileConnectorException fail the test instead of catching it. ZipTestUtils gains an overload that creates the zip in a given directory, and now also closes the stream when it writes an empty zip. The one-argument method delegates to it and still uses the system temp directory for UnzipEngineTest, which is removed separately. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Tony Germano <tony@germano.name>
The test task only includes classes matching **/*Test.class, so FileConnectionTests was never run by ./gradlew test or in CI. It needs no database or other infrastructure and passes, so rename it to FileConnectionTest. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Tony Germano <tony@germano.name>
tonygermano
requested review from
a team,
NicoPiel,
gibson9583,
jonbartels,
kayyagari,
kpalang,
mgaffigan and
ssrowe
November 16, 2026 16:50
gibson9583
approved these changes
Nov 16, 2026
pacmano1
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests that wrote into the working directory or
/tmpnow use JUnitTemporaryFolder, a smoke test covers message export to archives, and a misnamed test class now runs.MessageExportArchiveTestto the smoke tests. It exports messages to an unencrypted ZIP, a gzipped TAR and a password-protected ZIP for each encryption type, plus a server-side AES-256 export. It checks the archives with the JDK and commons-compress rather than zip4j, so it also holds across a zip4j upgrade (the follow-up PR).DefaultExtensionControllerTest,ArchiveUtilsTest,XsltStepTest,FileConnectionTests,Log4jMigrationsTest,Log4jBootstrapTestandXMLBatchAdaptorTesttoTemporaryFolder, so they leave nothing behind.FileConnectionTeststoFileConnectionTest. The rootbuild.gradleonly includes**/*Test.class, so Gradle never ran it.The server-side export in the smoke test writes under the server's
appdata/tempin asafe-to-delete-smoketest-export-*folder, because the harness can't delete server files. It is harmless in CI containers.Claude checked:
./gradlew clean build distpasses on this branch and/tmpis left clean.No release notes. Test and build changes only.
🤖 Drafted with Claude Code