You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/11/06 14:56:19 UTC

[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #5510: NIFI-9366 prevent unwanted provenance_repository directory being crea…

ChrisSamo632 commented on a change in pull request #5510:
URL: https://github.com/apache/nifi/pull/5510#discussion_r744133608



##########
File path: nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/groovy/org/apache/nifi/provenance/EncryptedWriteAheadProvenanceRepositoryTest.groovy
##########
@@ -205,7 +204,8 @@ class EncryptedWriteAheadProvenanceRepositoryTest {
         NiFiProperties properties = NiFiProperties.createBasicNiFiProperties(null, [
                 (NiFiProperties.PROVENANCE_REPO_ENCRYPTION_KEY_PROVIDER_IMPLEMENTATION_CLASS): StaticKeyProvider.class.name,
                 (NiFiProperties.PROVENANCE_REPO_ENCRYPTION_KEY): KEY_HEX,
-                (NiFiProperties.PROVENANCE_REPO_ENCRYPTION_KEY_ID): KEY_ID
+                (NiFiProperties.PROVENANCE_REPO_ENCRYPTION_KEY_ID): KEY_ID,
+                (NiFiProperties.PROVENANCE_REPO_DIRECTORY_PREFIX + "test"): File.createTempDir(getClass().simpleName).toString()

Review comment:
       I think actually that we want (maybe even need) separate directories for both of the test scenarios (and maybe others in future) as they use a mix of encrypted and "normal" preovnance writers (so mixing the two could result in unwanted behaviour in the tests)
   
   There's also an existing `closeRepo` method in the test class that applies some extra logic around deleting the files.directories created by the writer, so that seems like a better option to stick with compared to using `FileUtils` (and adding more dependencies into the module, even if only at `test` scope).
   
   So I'll create the temp directory `@BeforeEach` and ensure the class-level `config` is set by each scenario so that it's cleared away `@AfterEach` - I'll also add a final `deleteDir` to ensure it's removed `@AfterEach` as an extra catch-all
   
   Also noticed that the existing tests are using raw `assert`s, so I'll change that!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org