Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(search): introduce retry for search test #10206

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.linkedin.metadata.search.SearchResult;
import com.linkedin.metadata.search.SearchService;
import io.datahubproject.metadata.context.OperationContext;
import io.datahubproject.test.SearchRetry;
import io.datahubproject.test.metadata.context.TestOperationContexts;
import io.datahubproject.test.search.SearchTestUtils;
import java.util.Collections;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void testNameMatchPetProfile() {
assertTrue(secondResultUrn.toString().contains("pet_profiles"));
}

@Test
@Test(retryAnalyzer = SearchRetry.class)
public void testGlossaryTerms() {
/*
Searching for "ReturnRate" should return all tables that have the glossary term applied before
Expand Down
26 changes: 26 additions & 0 deletions metadata-io/src/test/java/io/datahubproject/test/SearchRetry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.datahubproject.test;

import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;

/** Used to retry search fixture tests 1 time after 5 seconds */
public class SearchRetry implements IRetryAnalyzer {

private int retryCount = 0;
private static final int maxRetryCount = 1;
private static final int delayMs = 5000;

@Override
public boolean retry(ITestResult result) {
if (retryCount < maxRetryCount) {
retryCount++;
try {
Thread.sleep(delayMs);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return true;
}
return false;
}
}
Loading