lhotari commented on code in PR #23274:
URL: https://github.com/apache/pulsar/pull/23274#discussion_r1756167637


##########
pulsar-common/src/test/java/org/apache/pulsar/common/nar/NarUnpackerTest.java:
##########
@@ -118,6 +118,30 @@ public static void main(String[] args) {
         }
     }
 
+    @Test
+    void shouldReExtractWhenUnpackedDirectoryIsMissing() throws 
InterruptedException {
+        CountDownLatch countDownLatch = new CountDownLatch(1);
+        AtomicInteger exceptionCounter = new AtomicInteger();
+        AtomicInteger extractCounter = new AtomicInteger();
+
+        new Thread(() -> {
+            try {
+                File narWorkingDirectory = 
NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, 
extractCounter::incrementAndGet);
+                FileUtils.deleteFile(narWorkingDirectory, true);
+                NarUnpacker.doUnpackNar(sampleZipFile, extractDirectory, 
extractCounter::incrementAndGet);
+            } catch (Exception e) {
+                log.error("Unpacking failed", e);
+                exceptionCounter.incrementAndGet();

Review Comment:
   This might introduce a flaky test since multiple threads are deleting the 
directory concurrently. It seems that a concurrency test doesn't make sense for 
testing that the unpacking happens when the working directory is missing.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to