Skip to content

Commit

Permalink
Fix Failing test for glossary (#19151)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohityadav766 authored Dec 20, 2024
1 parent 929c4ac commit d6a63ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2289,4 +2289,16 @@ protected void assertFieldLists(List<FieldChange> expectedList, List<FieldChange
actualListCopy.get(i).getOldValue());
}
}

public EventSubscription updateEventSubscriptionPollInterval(String fqn, int pollInterval)
throws HttpResponseException {
EventSubscriptionResourceTest eventSubscriptionResourceTest =
new EventSubscriptionResourceTest();
EventSubscription originalSub =
eventSubscriptionResourceTest.getEntityByName(fqn, ADMIN_AUTH_HEADERS);
EventSubscription updatedSub =
JsonUtils.deepCopy(originalSub, EventSubscription.class).withPollInterval(pollInterval);
return eventSubscriptionResourceTest.patchEntityUsingFqn(
fqn, JsonUtils.pojoToJson(originalSub), updatedSub, ADMIN_AUTH_HEADERS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
import org.openmetadata.service.jdbi3.GlossaryRepository.GlossaryCsv;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.resources.events.EventSubscriptionResourceTest;
import org.openmetadata.service.resources.feeds.FeedResource;
import org.openmetadata.service.resources.feeds.FeedResourceTest;
import org.openmetadata.service.resources.feeds.MessageParser;
Expand Down Expand Up @@ -757,6 +758,10 @@ invalidCustomPropertyKeyRecord, invalidCustomPropertyKey(11, "invalidCustomPrope

@Test
void testGlossaryImportExport() throws IOException {
EventSubscriptionResourceTest eventSubscriptionResourceTest =
new EventSubscriptionResourceTest();
// Update poll Interval to allow Status change from workflow to take some time
eventSubscriptionResourceTest.updateEventSubscriptionPollInterval("WorkflowEventConsumer", 120);
Glossary glossary = createEntity(createRequest("importExportTest"), ADMIN_AUTH_HEADERS);
String user1 = USER1.getName();
String user2 = USER2.getName();
Expand Down Expand Up @@ -934,25 +939,11 @@ void testGlossaryImportExport() throws IOException {
List<String> newRecords =
listOf(
",g3,dsp0,dsc0,h1;h2;h3,,term0;http://term0,PII.Sensitive,,,Approved,\"\"\"glossaryTermTableCol1Cp:row_1_col1_Value,,\"\";\"\"glossaryTermTableCol3Cp:row_1_col1_Value,row_1_col2_Value,row_1_col3_Value|row_2_col1_Value,row_2_col2_Value,row_2_col3_Value\"\"\"");
Awaitility.await()
.atMost(Duration.ofMillis(120 * 1000L))
.pollInterval(Duration.ofMillis(2000L))
.ignoreExceptions()
.until(
() -> {
try {
testImportExport(
glossary.getName(),
GlossaryCsv.HEADERS,
createRecords,
updateRecords,
newRecords);
return true;
} catch (Exception e) {
// Return false to retry
return false;
}
});
testImportExport(
glossary.getName(), GlossaryCsv.HEADERS, createRecords, updateRecords, newRecords);

// Reset poll Interval to allow Status change from workflow
eventSubscriptionResourceTest.updateEventSubscriptionPollInterval("WorkflowEventConsumer", 10);
}

@Test
Expand Down

0 comments on commit d6a63ea

Please sign in to comment.