From 3d71a24463841cb473d2ebc41915352218aff30f Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Wed, 4 Dec 2024 10:00:13 +0100 Subject: [PATCH 1/3] deps: bump Kubernetes Client from 6.13.1 to 7.0.0 --- .github/workflows/windows-tests.yml | 2 +- .../assertions/KubernetesClientAssertion.java | 2 +- .../windows/WindowsITCase.java | 19 +++++++++++-------- pom.xml | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows-tests.yml b/.github/workflows/windows-tests.yml index dae5f3ca..45c3d0ca 100644 --- a/.github/workflows/windows-tests.yml +++ b/.github/workflows/windows-tests.yml @@ -20,7 +20,7 @@ on: - main pull_request: schedule: - - cron: '0 1 * * *' # Everyday at 1 + - cron: '0 1 * * *' # Every day at 1 permissions: contents: read diff --git a/it/src/test/java/org/eclipse/jkube/integrationtests/assertions/KubernetesClientAssertion.java b/it/src/test/java/org/eclipse/jkube/integrationtests/assertions/KubernetesClientAssertion.java index 275bc733..a9a84c57 100644 --- a/it/src/test/java/org/eclipse/jkube/integrationtests/assertions/KubernetesClientAssertion.java +++ b/it/src/test/java/org/eclipse/jkube/integrationtests/assertions/KubernetesClientAssertion.java @@ -91,7 +91,7 @@ static void printDiagnosis(JKubeCase jKubeCase) throws IOException, InterruptedE System.err.println(pod.getStatus()); System.err.println("---------------------------"); }); - if (jKubeCase.getKubernetesClient().isAdaptable(OpenShiftClient.class)) { + if (jKubeCase.getKubernetesClient().adapt(OpenShiftClient.class).supports(Route.class)) { final OpenShiftClient oc = jKubeCase.getKubernetesClient().adapt(OpenShiftClient.class); System.err.println("\n\n==========================="); System.err.println("\nDeployment:"); diff --git a/it/src/test/java/org/eclipse/jkube/integrationtests/windows/WindowsITCase.java b/it/src/test/java/org/eclipse/jkube/integrationtests/windows/WindowsITCase.java index 5ac6e529..a9f964ba 100644 --- a/it/src/test/java/org/eclipse/jkube/integrationtests/windows/WindowsITCase.java +++ b/it/src/test/java/org/eclipse/jkube/integrationtests/windows/WindowsITCase.java @@ -13,9 +13,7 @@ */ package org.eclipse.jkube.integrationtests.windows; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; +import io.fabric8.kubernetes.client.utils.HttpClientUtils; import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.invoker.MavenInvocationException; import org.eclipse.jkube.integrationtests.jupiter.api.DockerRegistry; @@ -34,6 +32,7 @@ import java.nio.file.Files; import java.util.Collections; import java.util.Properties; +import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -97,11 +96,15 @@ void k8sPush() throws Exception { final InvocationResult invocationResult = maven("k8s:push", properties); // Then assertInvocation(invocationResult); - final Response response = new OkHttpClient.Builder().build().newCall(new Request.Builder() - .get().url("http://localhost:5000/v2/integration-tests/windows/tags/list").build()) - .execute(); - assertThat(response.body().string(), - containsString("{\"name\":\"integration-tests/windows\",\"tags\":[\"latest\"]}")); + final var httpFactory = HttpClientUtils.getHttpClientFactory(); + try (final var http = httpFactory.newBuilder().build()) { + final var req = http.newHttpRequestBuilder().uri("http://localhost:5000/v2/integration-tests/windows/tags/list") + .build(); + final var res = http.sendAsync(req, String.class).get(10, TimeUnit.SECONDS); + assertThat(res.isSuccessful(), equalTo(true)); + assertThat(res.bodyString(), + containsString("{\"name\":\"integration-tests/windows\",\"tags\":[\"latest\"]}")); + } } @Test diff --git a/pom.xml b/pom.xml index abc1a300..d8c29ab1 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 2.25.4 2.15.2 2.15.2 - 6.13.1 + 7.0.0 32.1.2-jre 8.7 0.0.3 From 3c7ad8a370d272b001f8f810deb2e0617b359e21 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 9 Dec 2024 10:04:13 +0100 Subject: [PATCH 2/3] fix: don't run helm native goals in unsupported OS --- .github/workflows/e2e-tests.yml | 2 +- .../springboot/helmconfig/HelmConfigK8sITCase.java | 4 ++++ .../springboot/helmconfig/HelmConfigOcITCase.java | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index f2f7fabf..0e0f2dd5 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -112,7 +112,7 @@ jobs: path: ./it/target/jkube-test-report.txt minikube-legacy: - name: K8S + name: K8S (Minikube Legacy) needs: build-jkube runs-on: ubuntu-20.04 strategy: diff --git a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigK8sITCase.java b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigK8sITCase.java index c5872482..16318279 100644 --- a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigK8sITCase.java +++ b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigK8sITCase.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import java.io.ByteArrayOutputStream; import java.io.File; @@ -118,6 +119,7 @@ void k8sHelmPush() throws Exception { @Test @DisplayName("k8s:helm-uninstall, no release present, display error message") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void k8sHelmUninstall_whenNoReleasePresent_thenErrorMessageDisplayed() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -133,6 +135,7 @@ void k8sHelmUninstall_whenNoReleasePresent_thenErrorMessageDisplayed() throws Ex @Test @Order(4) @DisplayName("k8s:helm-install, should install the charts") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void k8sHelmInstall() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -150,6 +153,7 @@ void k8sHelmInstall() throws Exception { @Test @Order(5) @DisplayName("k8s:helm-uninstall, should uninstall the charts") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void k8sHelmUninstall() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); diff --git a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigOcITCase.java b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigOcITCase.java index 61cd2be0..51fdf1ea 100644 --- a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigOcITCase.java +++ b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/helmconfig/HelmConfigOcITCase.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import java.io.ByteArrayOutputStream; import java.io.File; @@ -101,6 +102,7 @@ void ocHelm() throws Exception { @Test @Order(3) @DisplayName("oc:helm-push, should push the charts") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void ocHelmPush() throws Exception { // Given final Properties properties = properties( @@ -120,6 +122,7 @@ void ocHelmPush() throws Exception { @Test @DisplayName("oc:helm-uninstall, no release present, display error message") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void ocHelmUninstall_whenNoReleasePresent_thenErrorMessageDisplayed() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -135,6 +138,7 @@ void ocHelmUninstall_whenNoReleasePresent_thenErrorMessageDisplayed() throws Exc @Test @Order(4) @DisplayName("oc:helm-install, should install the charts") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void ocHelmInstall() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -152,6 +156,7 @@ void ocHelmInstall() throws Exception { @Test @Order(5) @DisplayName("oc:helm-uninstall, should uninstall the charts") + @DisabledIfEnvironmentVariable(named = "ImageOS", matches = "ubuntu20") void ocHelmUninstall() throws Exception { // Given ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); From 3ec09f3ff53750fa8b1cd7fbc42f4e14c1ec6c4a Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 9 Dec 2024 12:44:59 +0100 Subject: [PATCH 3/3] temp: temporarily disable kubernetes client JUnit --- .../integrationtests/springboot/zeroconfig/ZeroConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/zeroconfig/ZeroConfig.java b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/zeroconfig/ZeroConfig.java index 702dc5aa..951b2838 100644 --- a/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/zeroconfig/ZeroConfig.java +++ b/it/src/test/java/org/eclipse/jkube/integrationtests/springboot/zeroconfig/ZeroConfig.java @@ -16,6 +16,7 @@ import io.fabric8.junit.jupiter.api.KubernetesTest; import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClientBuilder; import org.eclipse.jkube.integrationtests.JKubeCase; import java.io.File; @@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.not; -@KubernetesTest(createEphemeralNamespace = false) +//@KubernetesTest(createEphemeralNamespace = false) abstract class ZeroConfig implements JKubeCase { protected static final String MAVEN_APPLICATION = "spring-boot-zero-config"; @@ -43,7 +44,8 @@ abstract class ZeroConfig implements JKubeCase { @Override public KubernetesClient getKubernetesClient() { - return kubernetesClient; + // TODO: REMOVE + return new KubernetesClientBuilder().build(); } final Pod assertThatShouldApplyResources() throws Exception {