Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Fix TraceSampleApplicationTests reading log format (#2377)
Browse files Browse the repository at this point in the history
  • Loading branch information
elefeint committed May 19, 2020
1 parent 514fcff commit 36d7c43
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.google.cloud.logging.LogEntry;
import com.google.cloud.logging.Logging;
import com.google.cloud.logging.LoggingOptions;
import com.google.cloud.logging.Payload.StringPayload;
import com.google.cloud.logging.Payload.JsonPayload;
import com.google.devtools.cloudtrace.v1.GetTraceRequest;
import com.google.devtools.cloudtrace.v1.Trace;
import com.google.devtools.cloudtrace.v1.TraceServiceGrpc;
Expand Down Expand Up @@ -155,7 +155,8 @@ public void testTracesAreLoggedCorrectly() {


List<String> logContents = logEntries.stream()
.map((logEntry) -> ((StringPayload) logEntry.getPayload()).getData())
.map((logEntry) -> (String) ((JsonPayload) logEntry.getPayload())
.getDataAsMap().get("message"))
.collect(Collectors.toList());

assertThat(logContents).contains("starting busy work");
Expand Down

0 comments on commit 36d7c43

Please sign in to comment.