Manybubbles has uploaded a new change for review. https://gerrit.wikimedia.org/r/215915
Change subject: Fix randomized test failure ...................................................................... Fix randomized test failure We have a test that asserts that compiling automata doesn't fail in unexpected way but it never covered one of the ways in which they are expected to sometimes fail. Now it does. Change-Id: I91616428c786d5dc9adfae4c9e63367b68c64b25 --- M src/test/java/org/wikimedia/search/extra/regex/ngram/NGramAutomatonTest.java 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/search/extra refs/changes/15/215915/1 diff --git a/src/test/java/org/wikimedia/search/extra/regex/ngram/NGramAutomatonTest.java b/src/test/java/org/wikimedia/search/extra/regex/ngram/NGramAutomatonTest.java index 00f8237..423098e 100644 --- a/src/test/java/org/wikimedia/search/extra/regex/ngram/NGramAutomatonTest.java +++ b/src/test/java/org/wikimedia/search/extra/regex/ngram/NGramAutomatonTest.java @@ -208,10 +208,20 @@ assertTrigramExpression(str, null); } + /** + * Tests that building the automaton doesn't blow up in unexpected ways. + */ @Test @Repeat(iterations=100) public void randomAutomaton() { - NGramAutomaton ngramAutomaton = new NGramAutomaton(XAutomatonTestUtil.randomAutomaton(getRandom()), between(2, 7), 4, 10000, 500); + XAutomaton automaton = XAutomatonTestUtil.randomAutomaton(getRandom()); + NGramAutomaton ngramAutomaton; + try { + ngramAutomaton = new NGramAutomaton(automaton, between(2, 7), 4, 10000, 500); + } catch (AutomatonTooComplexException e) { + // This is fine - some automata are genuinely too complex to ngramify. + return; + } Expression<String> expression = ngramAutomaton.expression(); expression = expression.simplify(); } -- To view, visit https://gerrit.wikimedia.org/r/215915 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I91616428c786d5dc9adfae4c9e63367b68c64b25 Gerrit-PatchSet: 1 Gerrit-Project: search/extra Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits