Skip to content

Commit 94f0222

Browse files
anthonydahanneZPascal
authored andcommitted
Fix expectations
* 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
1 parent bdc5ce3 commit 94f0222

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

cloudfoundry-operations/src/test/java/org/cloudfoundry/operations/applications/DefaultApplicationsTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.cloudfoundry.client.v3.LifecycleType.BUILDPACK;
2121
import static org.cloudfoundry.client.v3.LifecycleType.DOCKER;
2222
import static org.cloudfoundry.operations.TestObjects.fill;
23+
import static org.mockito.ArgumentMatchers.any;
2324
import static org.mockito.Mockito.RETURNS_SMART_NULLS;
2425
import static org.mockito.Mockito.mock;
2526
import static org.mockito.Mockito.when;
@@ -1326,7 +1327,7 @@ void logs() {
13261327
this.applications
13271328
.logs(ReadRequest.builder().sourceId("test-application-name").build())
13281329
.as(StepVerifier::create)
1329-
.expectNext(fill(Log.builder(), "log-message-").build())
1330+
.expectNextMatches(log -> log.getPayload().equals("test-payload"))
13301331
.expectComplete()
13311332
.verify(Duration.ofSeconds(5));
13321333
}
@@ -5327,16 +5328,16 @@ private static void requestListTasksEmpty(
53275328

53285329
private static void requestLogsRecentLogCache(LogCacheClient logCacheClient, String applicationId) {
53295330
when(logCacheClient.recentLogs(
5330-
ReadRequest.builder().sourceId(applicationId).build()))
5331+
any()))
53315332
.thenReturn(
53325333
Mono.just(fill(ReadResponse.builder())
5333-
.envelopes(fill(EnvelopeBatch.builder())
5334-
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
5335-
.log(fill(Log.builder())
5336-
.payload("test-payload")
5337-
.type(LogType.OUT).build())
5338-
.build())
5339-
.build())
5334+
.envelopes(fill(EnvelopeBatch.builder())
5335+
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
5336+
.log(fill(Log.builder())
5337+
.payload("test-payload")
5338+
.type(LogType.OUT).build())
5339+
.build())
5340+
.build())
53405341
.build()));
53415342
}
53425343

0 commit comments

Comments
 (0)