Fix project creation replication integration test
When a new project is created, the replication event is triggering
a remote 'git init --bare' using the adminUrl and the re-scheduled after
the retry period.
Make sure that the second retried replication event associated with the creation
of new projects is getting scheduled and executed properly.
Bug: Issue 12829
Change-Id: I0fdc1e73390c2abd3e40d2a02fd7e4ce7f20bb67
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index 49cb059..5af0983 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -292,12 +292,12 @@
}
public void release() {
- if (disableDeleteForTesting) {
- logger.atFine().log("DELETE %s %s DISABLED", runningDir, updateLog());
- return;
- }
-
try {
+ if (disableDeleteForTesting && Files.list(runningDir).findFirst().isPresent()) {
+ logger.atFine().log("DELETE %s %s DISABLED", runningDir, updateLog());
+ return;
+ }
+
logger.atFine().log("DELETE %s %s", runningDir, updateLog());
Files.delete(runningDir);
} catch (IOException e) {