Skip to content

Commit da90d99

Browse files
committed
TEST
1 parent 417ae7f commit da90d99

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

opamp-client/src/test/java/io/opentelemetry/opamp/client/internal/impl/OpampClientImplTest.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void onSuccess_withChangesToReport_notifyCallbackOnMessage() {
209209
requestService.sendRequest();
210210

211211
// Await for onMessage call
212-
await().atMost(Duration.ofSeconds(1)).until(() -> callbacks.onMessageCalls.get() == 1);
212+
await().atMost(Duration.ofSeconds(5)).until(() -> callbacks.onMessageCalls.get() == 1);
213213

214214
verify(callbacks).onMessage(MessageData.builder().setRemoteConfig(remoteConfig).build());
215215
}
@@ -249,25 +249,22 @@ void verifyAgentDescriptionSetter() {
249249
@Test
250250
void verifyRemoteConfigStatusSetter() {
251251
initializeClient();
252-
RemoteConfigStatus remoteConfigStatus =
253-
getRemoteConfigStatus(RemoteConfigStatuses.RemoteConfigStatuses_APPLYING);
252+
RemoteConfigStatus status = RemoteConfigStatus.builder().lastRemoteConfigHash("abcd").build();
254253

255254
// Update when changed
256-
enqueueServerToAgentResponse(new ServerToAgent.Builder().build());
257-
client.setRemoteConfigStatus(remoteConfigStatus);
255+
client.setRemoteConfigStatus(status);
258256
assertThat(takeRequest()).isNotNull();
259257

260258
// Ignore when the provided value is the same as the current one
261-
enqueueServerToAgentResponse(new ServerToAgent.Builder().build());
262-
client.setRemoteConfigStatus(remoteConfigStatus);
259+
client.setRemoteConfigStatus(status);
263260
assertThat(takeRequest()).isNull();
264261
}
265262

266263
@Test
267264
void onConnectionSuccessful_notifyCallback() {
268265
initializeClient();
269266

270-
await().atMost(Duration.ofSeconds(1)).until(() -> callbacks.onConnectCalls.get() == 1);
267+
await().atMost(Duration.ofSeconds(5)).until(() -> callbacks.onConnectCalls.get() == 1);
271268

272269
verify(callbacks).onConnect();
273270
verify(callbacks, never()).onConnectFailed(any());
@@ -311,7 +308,7 @@ void onFailedResponse_withServerErrorData_notifyCallback() {
311308
// Force request
312309
requestService.sendRequest();
313310

314-
await().atMost(Duration.ofSeconds(1)).until(() -> callbacks.onErrorResponseCalls.get() == 1);
311+
await().atMost(Duration.ofSeconds(5)).until(() -> callbacks.onErrorResponseCalls.get() == 1);
315312

316313
verify(callbacks).onErrorResponse(errorResponse);
317314
verify(callbacks, never()).onMessage(any());
@@ -344,7 +341,7 @@ void whenServerProvidesNewInstanceUid_useIt() {
344341
enqueueServerToAgentResponse(response);
345342
requestService.sendRequest();
346343

347-
await().atMost(Duration.ofSeconds(1)).until(() -> state.instanceUid.get() != initialUid);
344+
await().atMost(Duration.ofSeconds(5)).until(() -> state.instanceUid.get() != initialUid);
348345

349346
assertThat(state.instanceUid.get()).isEqualTo(serverProvidedUid);
350347
}
@@ -359,7 +356,7 @@ private static AgentToServer getAgentToServerMessage(RecordedRequest request) {
359356

360357
private RecordedRequest takeRequest() {
361358
try {
362-
return server.takeRequest(1, TimeUnit.SECONDS);
359+
return server.takeRequest(5, TimeUnit.SECONDS);
363360
} catch (InterruptedException e) {
364361
throw new RuntimeException(e);
365362
}

0 commit comments

Comments
 (0)