Fixed unit test failed with NIFI-7232

This closes #4117.

Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
Mark Payne 2020-03-06 11:46:16 -05:00 committed by Joe Witt
parent 20dda05f26
commit f283c1191c
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
1 changed files with 10 additions and 2 deletions

View File

@ -40,6 +40,7 @@ import org.apache.nifi.provenance.store.ArrayListEventStore;
import org.apache.nifi.provenance.store.EventStore;
import org.apache.nifi.provenance.store.StorageResult;
import org.apache.nifi.util.Tuple;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@ -83,6 +84,11 @@ public class TestLuceneEventIndex {
return System.getProperty("os.name").toLowerCase().startsWith("windows");
}
@Before
public void setup() {
idGenerator.set(0L);
}
@Test
public void testGetTimeRange() {
final long now = System.currentTimeMillis();
@ -170,7 +176,7 @@ public class TestLuceneEventIndex {
}
@Test(timeout = 60000)
public void testUnauthorizedEventsGetPlaceholdersForExpandChildren() throws InterruptedException {
public void testUnauthorizedEventsGetPlaceholdersForExpandChildren() throws InterruptedException, IOException {
assumeFalse(isWindowsEnvironment());
final RepositoryConfiguration repoConfig = createConfig(1);
repoConfig.setDesiredIndexSize(1L);
@ -224,13 +230,15 @@ public class TestLuceneEventIndex {
List<LineageNode> nodes = Collections.emptyList();
while (nodes.size() < 5) {
final ComputeLineageSubmission submission = index.submitExpandChildren(1L, user, allowForkEvents);
final ComputeLineageSubmission submission = index.submitExpandChildren(fork.getEventId(), user, allowForkEvents);
assertTrue(submission.getResult().awaitCompletion(15, TimeUnit.SECONDS));
nodes = submission.getResult().getNodes();
Thread.sleep(25L);
}
nodes.forEach(System.out::println);
assertEquals(5, nodes.size());
assertEquals(1L, nodes.stream().filter(n -> n.getNodeType() == LineageNodeType.FLOWFILE_NODE).count());