From dc4f624029f6e18b19ae61ae03d887608d205155 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 11:26:03 +0000 Subject: [PATCH 1/3] chore(deps): bump org.assertj:assertj-core from 3.24.2 to 3.25.0 Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.24.2 to 3.25.0. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.24.2...assertj-build-3.25.0) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 929306b1011..98b141e50f0 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ 5.10.1 - 3.24.2 + 3.25.0 4.2.0 22.3.3 4.11.0 From f7d67ac1903d6ce7cd2c885a29c9b8303016933c Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 2 Jan 2024 11:31:08 +0530 Subject: [PATCH 2/3] chore : fix ambigous references to assertThatThrownBy Signed-off-by: Rohan Kumar --- .../mock/crud/KubernetesCrudDispatcherPatchTest.java | 8 ++++---- .../kubernetes/client/http/StandardHttpClientTest.java | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java index 9933708a6b5..21bd983f6f7 100644 --- a/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java +++ b/junit/kubernetes-server-mock/src/test/java/io/fabric8/kubernetes/client/server/mock/crud/KubernetesCrudDispatcherPatchTest.java @@ -36,6 +36,7 @@ import java.util.function.UnaryOperator; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -319,11 +320,10 @@ void differentResourceVersionConflictEdit() { .addToData("key", "changed") .build()); // Then - assertThatThrownBy(patchedCmOp::patch) - .asInstanceOf(InstanceOfAssertFactories.type(KubernetesClientException.class)) + assertThatExceptionOfType(KubernetesClientException.class) + .isThrownBy(patchedCmOp::patch) .hasFieldOrPropertyWithValue("code", 409) - .extracting(KubernetesClientException::getMessage).asString() - .contains("the object has been modified;"); + .withMessageContaining("the object has been modified;"); } @Test diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java index f3664e9e9d4..feefd0a4b5c 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/StandardHttpClientTest.java @@ -41,6 +41,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -231,8 +232,9 @@ void testRequestTimeout() { }); Awaitility.await().atMost(10, TimeUnit.SECONDS).until(consumeFuture::isDone); - assertThatThrownBy(consumeFuture::get) - .isInstanceOf(ExecutionException.class).hasCauseInstanceOf(TimeoutException.class); + assertThatExceptionOfType(ExecutionException.class) + .isThrownBy(consumeFuture::get) + .withCauseExactlyInstanceOf(TimeoutException.class); } @Test From 60a4cd83abdbda57536c2dd9137cab9fee7a37f5 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Tue, 2 Jan 2024 11:02:02 +0100 Subject: [PATCH 3/3] test(mockwebserver): fix concurrency issues Signed-off-by: Marc Nuri --- .../io/fabric8/mockwebserver/DefaultMockServerTest.groovy | 2 +- .../mockwebserver/DefaultMockServerWebSocketTest.groovy | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy index 85a6d9ca769..5ff230abda4 100644 --- a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy +++ b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerTest.groovy @@ -620,7 +620,7 @@ class DefaultMockServerTest extends Specification { server.expect().get().withPath("/api/v1/users/watch") .andUpgradeToWebSocket() .open() - .immediately().andEmit("READY") + .waitFor(50L).andEmit("READY") .expectHttpRequest("/api/v1/create").andEmit("CREATED").once() .expectSentWebSocketMessage("CREATED").andEmit("WS-CREATED").once() .done() diff --git a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy index ac596b9cefe..41989c6ca69 100644 --- a/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy +++ b/junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy @@ -123,9 +123,13 @@ class DefaultMockServerWebSocketTest extends Specification { def wsReq = wsClient.webSocket().connect(server.port, server.getHostName(), "/websocket") and: "A WebSocket listener" wsReq.onComplete { ws -> - ws.result().closeHandler { _ -> - ws.result().close() + if (ws.result().isClosed()) { future.complete(ws.result().closeReason()) + } else { + ws.result().closeHandler { _ -> + ws.result().close() + future.complete(ws.result().closeReason()) + } } } and: "An instance of AsyncConditions"