From 5e7d8affeadbbb3901f9600fc907bc858c9155b5 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 6 Feb 2025 12:05:59 -0500 Subject: [PATCH] fix flaky test: removing dead states can turn the NFA into a DFA Instead assert that DFA doesn't turn into an NFA, that's what we care about. Closes #14210 --- .../org/apache/lucene/util/automaton/TestAutomaton.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java index e9e35416db4..11ba6bee79c 100644 --- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java +++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java @@ -880,9 +880,11 @@ public void testRandomFinite() throws Exception { newTerms.add(newTerm.toBytesRef()); } terms = newTerms; - boolean wasDeterministic1 = a.isDeterministic(); + boolean wasDeterministic = a.isDeterministic(); a = Operations.concatenate(Automata.makeString(prefix.utf8ToString()), a); - assertEquals(wasDeterministic1, a.isDeterministic()); + if (wasDeterministic) { + assertTrue(a.isDeterministic()); + } } break;