Skip to content

Commit

Permalink
fix golden test
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker committed Aug 26, 2023
1 parent aa1464f commit a82eb58
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.Map;

import static com.linkedin.metadata.Constants.*;
import static com.linkedin.metadata.ESTestConfiguration.REFRESH_INTERVAL_SECONDS;
import static org.mockito.ArgumentMatchers.anySet;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -225,6 +226,7 @@ public SearchService searchServiceHelper(
.bulkProcessor(_bulkProcessor)
.fixtureName(fixtureName)
.targetIndexPrefix(prefix)
.refreshIntervalSeconds(REFRESH_INTERVAL_SECONDS)
.build()
.read();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.Map;

import static com.linkedin.metadata.Constants.*;
import static com.linkedin.metadata.ESTestConfiguration.REFRESH_INTERVAL_SECONDS;


@TestConfiguration
Expand Down Expand Up @@ -154,6 +155,7 @@ protected LineageSearchService lineageSearchService(
.bulkProcessor(_bulkProcessor)
.fixtureName(fixtureName)
.targetIndexPrefix(prefix)
.refreshIntervalSeconds(REFRESH_INTERVAL_SECONDS)
.build()
.read();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@TestConfiguration
public class ESTestConfiguration {
private static final int HTTP_PORT = 9200;
private static final int REFRESH_INTERVAL_SECONDS = 5;
public static final int REFRESH_INTERVAL_SECONDS = 5;

public static void syncAfterWrite(ESBulkProcessor bulkProcessor) throws InterruptedException {
bulkProcessor.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.util.Set;

import static com.linkedin.metadata.ESTestConfiguration.REFRESH_INTERVAL_SECONDS;
import static com.linkedin.metadata.ESTestUtils.environmentRestClientBuilder;

@TestConfiguration
Expand Down Expand Up @@ -111,6 +112,7 @@ private void reindexTestFixtureData() throws IOException {
FixtureReader reader = FixtureReader.builder()
.bulkProcessor(bulkProcessor)
.fixtureName("long_tail")
.refreshIntervalSeconds(REFRESH_INTERVAL_SECONDS)
.build();

reader.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class FixtureReader {
@Builder.Default
private String targetIndexPrefix = "";

private long refreshIntervalSeconds;

public Set<String> read() throws IOException {
try (Stream<Path> files = Files.list(Paths.get(String.format("%s/%s", inputBase, fixtureName)))) {
return files.map(file -> {
Expand Down Expand Up @@ -64,7 +66,7 @@ public Set<String> read() throws IOException {
} finally {
bulkProcessor.flush();
try {
Thread.sleep(1000);
Thread.sleep(1000 * refreshIntervalSeconds);
} catch (InterruptedException ignored) {
}
}
Expand Down

0 comments on commit a82eb58

Please sign in to comment.