-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AVRO-3863: [Java] Delete temporary test data after tests finish #2506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for your contribution -- this is a really good catch!
It looks like all of these tests have been migrated to JUnit5. Would it be possible to use the @TempDir
annotation to manage these resources? I think it's a much more common approach!
Path file = Paths.get(DIR.getPath() + "testMappedByteBuffer.avro"); | ||
file.toFile().deleteOnExit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path file = Paths.get(DIR.getPath() + "testMappedByteBuffer.avro"); | |
file.toFile().deleteOnExit(); | |
Path file = DIR.toPath().resolve( "testMappedByteBuffer.avro"); |
For example: here we have a @TempDir
already present, and cleaned up automatically in the test case -- we just accidentally forgot the path separator so the file was outside!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, O.K. I'll try it.
|
||
@SuppressWarnings("restriction") | ||
public class TestDataFileReader { | ||
@TempDir | ||
public Path DATA_DIR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we relook at the variable name once please? This format used is for constants, giving an impression that it is static final. Same for similar name in other classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks so much for this clean up and thanks @mystic-lama for the review :D
AVRO-3863
What is the purpose of the change
This PR proposes to delete temporary test data generated by tests for Java SDK.
Tests for Java SDK creates some test data, which are left even after tests finish.
Verifying this change
The tests still pass even after this change.
Also, test data are deleted.
Documentation