Repository navigation
[Testing] Improve Functions unit tests by using unique nar extraction directory - #10032
Conversation
|
@jerrypeng @david-streamlio please review this PR. It's a change in Pulsar Functions tests. |
|
I noticed that there's a gap in this PR. There also needs to be handling for these temp files: |
|
We should be cleaning the env when the test starts not when it ends, there is no value in cleanup then. |
ad1846d to
b7ef815
Compare
Usually resources should be cleaned up and not left around. Isn't this the case? |
I addressed the cleanup of these files by using the nar extraction directory as the temporary directory for these files. I think that it should be ok for that purpose. Adding yet another configuration parameter for the downloaded files would be adding too much overhead. |
|
/pulsarbot run-failure-checks |
|
We cannot use the same directory and clean it up, otherwise we are not able to support concurrent tests. |
b7ef815 to
e581b1a
Compare
| this.secretsProviderConfig = secretsProviderConfig; | ||
| this.narExtractionDirectory = narExtractionDirectory != null ? narExtractionDirectory | ||
| : NarClassLoader.DEFAULT_NAR_EXTRACTION_DIR; | ||
| if (narExtractionDirectory != null) { |
There was a problem hiding this comment.
We are changing the existing behavior here. If the narExtractionDirectory is not specified we should default to NarClassLoader.DEFAULT_NAR_EXTRACTION_DIR
There was a problem hiding this comment.
The change in behavior is intentional for LocalRunner. The intent of the changes are that unless narExtractionDirectory is specified, a temporary directory will be created which is deleted when LocalRunner.close() is called. Do you think that this type of behavior is unacceptable? I hope it would be ok to do this change since it reduces the chance that temporary files get left in the main system temp directory.
Thanks for the review @jerrypeng . I'll soon push changes to address your review comments about the deleted files check (I'll bring that back). |
e581b1a to
936c41b
Compare
|
@jerrypeng I have addressed the review comments. PTAL |
|
/pulsarbot run-failure-checks |
3 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
936c41b to
943e7f4
Compare
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
943e7f4 to
555ea60
Compare
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
… directory - Use unique temporary nar extraction directory for each test - This fixes possible issues caused by running tests with testForkCount > 1 setting (current status in master branch) - Delete directory consistently in AfterMethod - Add feature LocalRunner to create a unique temp directory for extracting nar files. Delete directory on close - Fix some ClassLoader resource cleanup issues that came up while working on the changes
555ea60 to
778b72b
Compare
|
/pulsarbot run-failure-checks |
7 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
… directory (apache#10032) - Use unique temporary nar extraction directory for each test - This fixes possible issues caused by running tests with testForkCount > 1 setting (current status in master branch) - Delete directory consistently in AfterMethod - Add feature LocalRunner to create a unique temp directory for extracting nar files. Delete directory on close - Fix some ClassLoader resource cleanup issues that came up while working on the changes
Motivation
Modifications
Create unique temporary directory for each test and use this temporary directory for
WorkerConfignarExtractionDirectory,downloadDirectoryandconnectorDirectorysettingsAdd a feature to LocalRunner to create a unique temp directory for extracting nar files. Delete directory on close
Fix some ClassLoader resource cleanup issues that came up while working on the changes
Fix a flakiness issue that showed up in FileServer that is used in Pulsar Function Tests to serve files over http (for testing purposes).