Skip to content

Commit

Permalink
Fix expectations
Browse files Browse the repository at this point in the history
* because of the findFirst() on the envelopes, it could be type OUT or ERR, so we don't really care, as long as the payload is the same.
Also, we don't care about the precise argument to the recentLogs call
  • Loading branch information
anthonydahanne committed Oct 31, 2024
1 parent 1f916f1 commit cc98144
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.cloudfoundry.client.v3.LifecycleType.BUILDPACK;
import static org.cloudfoundry.client.v3.LifecycleType.DOCKER;
import static org.cloudfoundry.operations.TestObjects.fill;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.RETURNS_SMART_NULLS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -1326,7 +1327,7 @@ void logs() {
this.applications
.logs(ReadRequest.builder().sourceId("test-application-name").build())
.as(StepVerifier::create)
.expectNext(fill(Log.builder(), "log-message-").build())
.expectNextMatches(log -> log.getPayload().equals("test-payload"))
.expectComplete()
.verify(Duration.ofSeconds(5));
}
Expand Down Expand Up @@ -5258,16 +5259,16 @@ private static void requestListTasksEmpty(

private static void requestLogsRecentLogCache(LogCacheClient logCacheClient, String applicationId) {
when(logCacheClient.recentLogs(
ReadRequest.builder().sourceId(applicationId).build()))
any()))
.thenReturn(
Mono.just(fill(ReadResponse.builder())
.envelopes(fill(EnvelopeBatch.builder())
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
.log(fill(Log.builder())
.payload("test-payload")
.type(LogType.OUT).build())
.build())
.build())
.envelopes(fill(EnvelopeBatch.builder())
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
.log(fill(Log.builder())
.payload("test-payload")
.type(LogType.OUT).build())
.build())
.build())
.build()));
}

Expand Down

0 comments on commit cc98144

Please sign in to comment.