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

ESQL: Fix logging test #108520

Merged
merged 3 commits into from
May 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,16 @@ public void testDoNotLogWithInfo() throws IOException {
Map<String, String> colA = Map.of("name", "DO_NOT_LOG_ME", "type", "integer");
assertEquals(List.of(colA), result.get("columns"));
assertEquals(List.of(List.of(1)), result.get("values"));
try (InputStream log = cluster.getNodeLog(0, LogType.SERVER)) {
Streams.readAllLines(log, line -> { assertThat(line, not(containsString("DO_NOT_LOG_ME"))); });
for (int i = 0; i < cluster.getNumNodes(); i++) {
try (InputStream log = cluster.getNodeLog(i, LogType.SERVER)) {
Streams.readAllLines(log, line -> assertThat(line, not(containsString("DO_NOT_LOG_ME"))));
}
}
} finally {
setLoggingLevel(null);
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/108367")
public void testDoLogWithDebug() throws IOException {
try {
setLoggingLevel("DEBUG");
Expand All @@ -136,14 +137,16 @@ public void testDoLogWithDebug() throws IOException {
Map<String, String> colA = Map.of("name", "DO_LOG_ME", "type", "integer");
assertEquals(List.of(colA), result.get("columns"));
assertEquals(List.of(List.of(1)), result.get("values"));
try (InputStream log = cluster.getNodeLog(0, LogType.SERVER)) {
boolean[] found = new boolean[] { false };
Streams.readAllLines(log, line -> {
if (line.contains("DO_LOG_ME")) {
found[0] = true;
}
});
assertThat(found[0], equalTo(true));
boolean[] found = new boolean[] { false };
for (int i = 0; i < cluster.getNumNodes(); i++) {
try (InputStream log = cluster.getNodeLog(0, LogType.SERVER)) {
nik9000 marked this conversation as resolved.
Show resolved Hide resolved
Streams.readAllLines(log, line -> {
if (line.contains("DO_LOG_ME")) {
found[0] = true;
}
});
assertThat(found[0], equalTo(true));
}
}
nik9000 marked this conversation as resolved.
Show resolved Hide resolved
} finally {
setLoggingLevel(null);
Expand Down