From 9aaf32a0ef47e50595ed65984c0f3a4058aac1f8 Mon Sep 17 00:00:00 2001 From: Toon Geens Date: Wed, 18 Oct 2023 10:55:31 +0200 Subject: [PATCH 1/5] Add k3s:v1.17.17 test for backwards compatability --- .../testcontainers/k3s/Fabric8K3sContainerTest.java | 11 ++++++++++- .../k3s/OfficialClientK3sContainerTest.java | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java index 42b08444555..de96274aa2a 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java @@ -26,9 +26,18 @@ public class Fabric8K3sContainerTest { @Test public void shouldStartAndHaveListableNode() { + runK3s(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")); + } + + @Test + public void shouldStartAndHaveListableNode_backwardsCompat() { + runK3s(DockerImageName.parse("rancher/k3s:v1.17.17-k3s1")); + } + + private void runK3s(DockerImageName k3sDockerImage) { try ( // starting_k3s { - K3sContainer k3s = new K3sContainer(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")) + K3sContainer k3s = new K3sContainer(k3sDockerImage) .withLogConsumer(new Slf4jLogConsumer(log)) // } ) { diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java index 7edc286837b..e3e333aa8ca 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java @@ -20,9 +20,18 @@ public class OfficialClientK3sContainerTest { @Test public void shouldStartAndHaveListableNode() throws IOException, ApiException { + runK3s(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")); + } + + @Test + public void shouldStartAndHaveListableNode_backwardsCompat() throws IOException, ApiException { + runK3s(DockerImageName.parse("rancher/k3s:v1.17.17-k3s1")); + } + + private void runK3s(DockerImageName k3sDockerImage) throws IOException, ApiException { try ( // starting_k3s { - K3sContainer k3s = new K3sContainer(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")) + K3sContainer k3s = new K3sContainer(k3sDockerImage) .withLogConsumer(new Slf4jLogConsumer(log)) // } ) { From a7f78945260d0f7e2ed99f7364b515f523b83436 Mon Sep 17 00:00:00 2001 From: Toon Geens Date: Fri, 20 Oct 2023 10:38:29 +0200 Subject: [PATCH 2/5] PR feedback --- .../testcontainers/k3s/Fabric8K3sContainerTest.java | 11 +---------- .../k3s/OfficialClientK3sContainerTest.java | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java index de96274aa2a..42b08444555 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/Fabric8K3sContainerTest.java @@ -26,18 +26,9 @@ public class Fabric8K3sContainerTest { @Test public void shouldStartAndHaveListableNode() { - runK3s(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")); - } - - @Test - public void shouldStartAndHaveListableNode_backwardsCompat() { - runK3s(DockerImageName.parse("rancher/k3s:v1.17.17-k3s1")); - } - - private void runK3s(DockerImageName k3sDockerImage) { try ( // starting_k3s { - K3sContainer k3s = new K3sContainer(k3sDockerImage) + K3sContainer k3s = new K3sContainer(DockerImageName.parse("rancher/k3s:v1.21.3-k3s1")) .withLogConsumer(new Slf4jLogConsumer(log)) // } ) { diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java index e3e333aa8ca..db0ff674265 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java @@ -24,7 +24,7 @@ public void shouldStartAndHaveListableNode() throws IOException, ApiException { } @Test - public void shouldStartAndHaveListableNode_backwardsCompat() throws IOException, ApiException { + public void shouldStartAndHaveListableNodeUsingLowerVersion() throws IOException, ApiException { runK3s(DockerImageName.parse("rancher/k3s:v1.17.17-k3s1")); } From 2dcead892c5bafe61918997d321b0dc7cecf8b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Fri, 20 Oct 2023 13:30:22 -0600 Subject: [PATCH 3/5] Remove unused tag for docs --- .../testcontainers/k3s/OfficialClientK3sContainerTest.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java index db0ff674265..96b268a2028 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java @@ -29,12 +29,7 @@ public void shouldStartAndHaveListableNodeUsingLowerVersion() throws IOException } private void runK3s(DockerImageName k3sDockerImage) throws IOException, ApiException { - try ( - // starting_k3s { - K3sContainer k3s = new K3sContainer(k3sDockerImage) - .withLogConsumer(new Slf4jLogConsumer(log)) - // } - ) { + try (K3sContainer k3s = new K3sContainer(k3sDockerImage).withLogConsumer(new Slf4jLogConsumer(log))) { k3s.start(); // connecting_with_k8sio { From 23721019b49974dfb09cb268516377ade8be0e53 Mon Sep 17 00:00:00 2001 From: Toon Geens Date: Tue, 24 Oct 2023 17:12:15 +0200 Subject: [PATCH 4/5] K3s lower-version 1.20.15 --- .../org/testcontainers/k3s/OfficialClientK3sContainerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java index 96b268a2028..1c40e56fc2d 100644 --- a/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java +++ b/modules/k3s/src/test/java/org/testcontainers/k3s/OfficialClientK3sContainerTest.java @@ -25,7 +25,7 @@ public void shouldStartAndHaveListableNode() throws IOException, ApiException { @Test public void shouldStartAndHaveListableNodeUsingLowerVersion() throws IOException, ApiException { - runK3s(DockerImageName.parse("rancher/k3s:v1.17.17-k3s1")); + runK3s(DockerImageName.parse("rancher/k3s:v1.20.15-k3s1")); } private void runK3s(DockerImageName k3sDockerImage) throws IOException, ApiException { From dddddb527dc337b9fc1040a2fddbaa98be2672f0 Mon Sep 17 00:00:00 2001 From: Toon Geens Date: Tue, 17 Oct 2023 09:22:29 +0200 Subject: [PATCH 5/5] Fixes k3s container command flags --- .../k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java b/modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java index 0ee3db4b6e7..b014c5b4ed6 100644 --- a/modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java +++ b/modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java @@ -46,7 +46,7 @@ public K3sContainer(DockerImageName dockerImageName) { tmpFsMapping.put("/var/run", ""); setTmpFsMapping(tmpFsMapping); - setCommand("server", "--no-deploy=traefik", "--tls-san=" + this.getHost()); + setCommand("server", "--disable=traefik", "--tls-san=" + this.getHost()); setWaitStrategy(new LogMessageWaitStrategy().withRegEx(".*Node controller sync successful.*")); }