Local running of unit tests is unsuccessful.
When attempting to execute JUnit tests in the local environment for the core part of the search service, we observe 11 unsuccessful tests:
Results :
Tests in error:
testQueryIndex_whenNoCursorInSearchQueryAndSearchHitsIsEmpty(org.opengroup.osdu.search.provider.impl.ScrollCoreQueryServiceImplTest): Error processing search request
testQueryIndex_whenSearchGives500_thenThrowException(org.opengroup.osdu.search.provider.impl.ScrollCoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<org.junit.ComparisonFailure>
testQueryBase_whenClientSearchResultsInElasticsearchStatusException_statusServiceUnavailable_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_whenClientSearchResultsInElasticsearchStatusException_statusNotFound_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_whenClientSearchResultsInElasticsearchStatusException_statusBadRequest_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_whenClientSearchResultsInElasticsearchStatusException_statusTooManyRequests_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_SocketTimeoutException_ListenerTimeout_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_whenUnsupportedSortRequested_statusBadRequest_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_IOException_ListenerTimeout_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
testQueryBase_IOException_RespopnseTooLong_throwsException(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Unexpected exception, expected<org.opengroup.osdu.core.common.model.http.AppException> but was<java.lang.AssertionError>
should_return_CorrectQueryResponseforIntersectionSpatialFilter(org.opengroup.osdu.search.provider.impl.CoreQueryServiceImplTest): Error processing search request
Tests run: 200, Failures: 0, Errors: 11, Skipped: 10
It seems likely that these issues share a common underlying cause:
if (!autocompleteFeatureFlag.isFeatureEnabled(AUTOCOMPLETE_FEATURE_NAME) || suggestPhrase == null || suggestPhrase == "") { return null; }
For example, 'should_return_CorrectQueryResponseforIntersectionSpatialFilter'
@Test(expected = AppException.class)
public void testQueryBase_IOException_RespopnseTooLong_throwsException() throws IOException {
IOException exception = mock(IOException.class);
doReturn(new ContentTooLongException(null)).when(exception).getCause();
doReturn("dummyMessage").when(exception).getMessage();
doThrow(exception).when(client).search(any(), any(RequestOptions.class));
try {
sut.queryIndex(searchRequest);
} catch (AppException e) {
int errorCode = 413;
String errorMessage = "Elasticsearch response is too long, max is 100Mb";
validateAppException(e, errorCode, errorMessage);
throw (e);
}
}
It appears that there is a missing property or stub for the 'AUTOCOMPLETE_FEATURE_NAME' feature.
Besides, I could not find tests in !624 (merged)