Test that checker with invalid query is treated as not required for combined check state
This adds test coverage for the block that catches
ConfigInvalidException in Checker#isCheckerRelevant
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: If6b772c54b4b3084153c94f1603186ef28d0caea
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/db/GetCombinedCheckStateIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/db/GetCombinedCheckStateIT.java
index 0eb82ae..4941b1f 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/db/GetCombinedCheckStateIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/db/GetCombinedCheckStateIT.java
@@ -20,6 +20,7 @@
import com.google.gerrit.plugins.checks.CheckerUuid;
import com.google.gerrit.plugins.checks.Checks;
import com.google.gerrit.plugins.checks.acceptance.AbstractCheckersTest;
+import com.google.gerrit.plugins.checks.acceptance.testsuite.CheckerTestData;
import com.google.gerrit.plugins.checks.acceptance.testsuite.TestCheckerCreation;
import com.google.gerrit.plugins.checks.api.BlockingCondition;
import com.google.gerrit.plugins.checks.api.CheckState;
@@ -69,6 +70,16 @@
}
@Test
+ public void returnsWarningForFailedCheckWhoseCheckerHasInvalidQuery() throws Exception {
+ CheckerUuid checkerUuid = newRequiredChecker().query(CheckerTestData.INVALID_QUERY).create();
+ setCheckState(checkerUuid, CheckState.FAILED);
+
+ CombinedCheckState combinedCheckState = checks.getCombinedCheckState(project, patchSetId);
+
+ assertThat(combinedCheckState).isEqualTo(CombinedCheckState.WARNING);
+ }
+
+ @Test
public void returnsFailedWhenAnyRequiredCheckerFailed() throws Exception {
CheckerUuid checkerUuid = newRequiredChecker().create();
setCheckSuccessful(checkerUuid);