Skip to content

Commit

Permalink
Fixes two unit tests that have failed and are probably flaky. The Par…
Browse files Browse the repository at this point in the history
…seTreeEvaluatorListenerTest appears to be using negative values sometimes, which seems to be unsupported. The OTelLogsSourceTest test failed as well, but it appears this code may not always be executed because it was mixing Hamcrest and Mockito.

Signed-off-by: David Venable <[email protected]>
  • Loading branch information
dlvenable committed Aug 14, 2023
1 parent 28fdf90 commit 584aba0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void testSimpleRelationalOperatorExpressionWithInValidLiteralType() {
@Test
void testSimpleRelationalOperatorExpressionWithJsonPointerTypeValidValue() {
final String testKey = "testKey";
final int testValue = random.nextInt(1000);
final int testValue = random.nextInt(1000) + 2;
final Map<String, Integer> data = Map.of(testKey, testValue);
final Event testEvent = createTestEvent(data);
final String greaterThanStatement = String.format(" /%s > %d", testKey, testValue - 1);
Expand All @@ -207,7 +207,7 @@ void testSimpleRelationalOperatorExpressionWithJsonPointerTypeValidValue() {
}

@Test
void testSimpleRelationalOperatorExpressionWithJsonPointerTypeInValidValue() {
void testSimpleRelationalOperatorExpressionWithJsonPointerTypeInValidValueWithPositiveInteger() {
final String testKey = "testKey";
final boolean testValue = true;
final Map<String, Boolean> data = Map.of(testKey, testValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import java.util.stream.Stream;
import java.util.zip.GZIPOutputStream;

import static org.hamcrest.Matchers.hasItem;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.opensearch.dataprepper.plugins.source.otellogs.OTelLogsSourceConfig.DEFAULT_PORT;
import static org.opensearch.dataprepper.plugins.source.otellogs.OTelLogsSourceConfig.DEFAULT_REQUEST_TIMEOUT_MS;
Expand Down Expand Up @@ -800,8 +801,9 @@ private void assertSecureResponseWithStatusCode(final AggregatedHttpResponse res
.stream()
.map(Map.Entry::getKey)
.map(AsciiString::toString)
.map(String::toLowerCase)
.collect(Collectors.toList());
assertThat("Response Header Keys", headerKeys, not(contains("server")));
assertThat("Response Header Keys", headerKeys, not(hasItem("server")));
}

private byte[] createGZipCompressedPayload(final String payload) throws IOException {
Expand Down

0 comments on commit 584aba0

Please sign in to comment.