Skip to content

Commit 85e6462

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 7a032be commit 85e6462

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

+10-9
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
}
@@ -5258,16 +5259,16 @@ private static void requestListTasksEmpty(
52585259

52595260
private static void requestLogsRecentLogCache(LogCacheClient logCacheClient, String applicationId) {
52605261
when(logCacheClient.recentLogs(
5261-
ReadRequest.builder().sourceId(applicationId).build()))
5262+
any()))
52625263
.thenReturn(
52635264
Mono.just(fill(ReadResponse.builder())
5264-
.envelopes(fill(EnvelopeBatch.builder())
5265-
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
5266-
.log(fill(Log.builder())
5267-
.payload("test-payload")
5268-
.type(LogType.OUT).build())
5269-
.build())
5270-
.build())
5265+
.envelopes(fill(EnvelopeBatch.builder())
5266+
.batch(fill(org.cloudfoundry.logcache.v1.Envelope.builder())
5267+
.log(fill(Log.builder())
5268+
.payload("test-payload")
5269+
.type(LogType.OUT).build())
5270+
.build())
5271+
.build())
52715272
.build()));
52725273
}
52735274

0 commit comments

Comments
 (0)