Merge branch 'stable-3.7' into stable-3.8 * stable-3.7: Add missing Singleton to ActiveWokersCheck and DeadlockCheck Add active http workers check Change-Id: I2262f7071c55e739b52d151f3f7d5a258f2f08df
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8cdcd0b --- /dev/null +++ b/.gitignore
@@ -0,0 +1,3 @@ +# IntelliJ files +.idea +*.iml \ No newline at end of file
diff --git a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java index 5c1fd73..b589dcc 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java
@@ -15,6 +15,7 @@ package com.googlesource.gerrit.plugins.healthcheck; import static com.google.common.truth.Truth.assertThat; +import static com.google.gerrit.testing.TestActionRefUpdateContext.testRefAction; import static com.googlesource.gerrit.plugins.healthcheck.HealthCheckConfig.DEFAULT_CONFIG; import static com.googlesource.gerrit.plugins.healthcheck.check.HealthCheckNames.JGIT; import static org.eclipse.jgit.lib.RefUpdate.Result.NEW; @@ -130,17 +131,20 @@ } private void createCommit(InMemoryRepositoryManager.Repo repo, String ref) throws IOException { - try (ObjectInserter oi = repo.newObjectInserter()) { - CommitBuilder cb = new CommitBuilder(); - cb.setTreeId(oi.insert(Constants.OBJ_TREE, new byte[] {})); - cb.setAuthor(personIdent); - cb.setCommitter(personIdent); - cb.setMessage("Test commit\n"); - ObjectId id = oi.insert(cb); - oi.flush(); - RefUpdate ru = repo.updateRef(ref); - ru.setNewObjectId(id); - assertThat(ru.update()).isEqualTo(NEW); - } + testRefAction( + () -> { + try (ObjectInserter oi = repo.newObjectInserter()) { + CommitBuilder cb = new CommitBuilder(); + cb.setTreeId(oi.insert(Constants.OBJ_TREE, new byte[] {})); + cb.setAuthor(personIdent); + cb.setCommitter(personIdent); + cb.setMessage("Test commit\n"); + ObjectId id = oi.insert(cb); + oi.flush(); + RefUpdate ru = repo.updateRef(ref); + ru.setNewObjectId(id); + assertThat(ru.update()).isEqualTo(NEW); + } + }); } }