From 1b8488d2594ae3266d220d8b0a63f486e617dad0 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Tue, 3 Oct 2023 21:19:50 +0200 Subject: [PATCH] Adopt to the updated api-model See https://github.com/gesellix/docker-client/commit/359485188fb739d697fb2151e0447eb1e080145f (PR https://github.com/gesellix/docker-client/pull/562) --- .../container/ManageContainerClient.groovy | 20 ++++++++++--------- .../client/stack/DeployConfigReader.groovy | 10 ++++++++-- .../client/volume/ManageVolumeClient.java | 4 +++- .../ManageContainerClientTest.groovy | 6 +++--- .../stack/DeployConfigReaderTest.groovy | 2 ++ .../volume/ManageVolumeClientTest.groovy | 4 ++-- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/client/src/main/groovy/de/gesellix/docker/client/container/ManageContainerClient.groovy b/client/src/main/groovy/de/gesellix/docker/client/container/ManageContainerClient.groovy index 9fefdba1e..ab8a53b5d 100644 --- a/client/src/main/groovy/de/gesellix/docker/client/container/ManageContainerClient.groovy +++ b/client/src/main/groovy/de/gesellix/docker/client/container/ManageContainerClient.groovy @@ -265,6 +265,7 @@ class ManageContainerClient implements ManageContainer { true, true, null, + null, (execConfig.Tty ?: false) as Boolean, null, command, @@ -276,7 +277,8 @@ class ManageContainerClient implements ManageContainer { String execId = execCreateResult.content.id ExecStartConfig execStartConfig = new ExecStartConfig( (execConfig.Detach ?: false) as Boolean, - actualExecConfig.tty) + actualExecConfig.tty, + null) startExec(execId, execStartConfig, callback, timeout) return execCreateResult } @@ -333,14 +335,14 @@ class ManageContainerClient implements ManageContainer { // def multiplexStreams = !inspectContainer(container).content.config.tty client.containerApi.containerLogs(container, - actualQuery.follow as Boolean, - actualQuery.stdout as Boolean, - actualQuery.stderr as Boolean, - actualQuery.since as Integer, - actualQuery.until as Integer, - actualQuery.timestamps as Boolean, - actualQuery.tail as String, - callback, timeout.toMillis()) + actualQuery.follow as Boolean, + actualQuery.stdout as Boolean, + actualQuery.stderr as Boolean, + actualQuery.since as Integer, + actualQuery.until as Integer, + actualQuery.timestamps as Boolean, + actualQuery.tail as String, + callback, timeout.toMillis()) } @Override diff --git a/client/src/main/groovy/de/gesellix/docker/client/stack/DeployConfigReader.groovy b/client/src/main/groovy/de/gesellix/docker/client/stack/DeployConfigReader.groovy index e80501f3d..185c2f958 100644 --- a/client/src/main/groovy/de/gesellix/docker/client/stack/DeployConfigReader.groovy +++ b/client/src/main/groovy/de/gesellix/docker/client/stack/DeployConfigReader.groovy @@ -382,12 +382,13 @@ class DeployConfigReader { Long timeout = null Long interval = null Long startPeriod = null + Long startInterval = null if (healthcheck.disable) { if (healthcheck.test?.parts) { throw new IllegalArgumentException("test and disable can't be set at the same time") } - return new HealthConfig(["NONE"], null, null, null, null) + return new HealthConfig(["NONE"], null, null, null, null, null) } if (healthcheck.timeout) { @@ -402,13 +403,18 @@ class DeployConfigReader { if (healthcheck.startPeriod) { startPeriod = parseDuration(healthcheck.startPeriod).toNanos() } + // TODO add this one +// if (healthcheck.startInterval) { +// startInterval = parseDuration(healthcheck.startInterval).toNanos() +// } return new HealthConfig( healthcheck.test.parts, interval ?: 0, timeout ?: 0, retries, - startPeriod + startPeriod, + startInterval ) } diff --git a/client/src/main/groovy/de/gesellix/docker/client/volume/ManageVolumeClient.java b/client/src/main/groovy/de/gesellix/docker/client/volume/ManageVolumeClient.java index 889e6cd6e..cd0602c11 100644 --- a/client/src/main/groovy/de/gesellix/docker/client/volume/ManageVolumeClient.java +++ b/client/src/main/groovy/de/gesellix/docker/client/volume/ManageVolumeClient.java @@ -1,6 +1,7 @@ package de.gesellix.docker.client.volume; import de.gesellix.docker.client.EngineResponseContent; +import de.gesellix.docker.remote.api.ClusterVolumeSpec; import de.gesellix.docker.remote.api.EngineApiClient; import de.gesellix.docker.remote.api.Volume; import de.gesellix.docker.remote.api.VolumeCreateOptions; @@ -72,7 +73,8 @@ public EngineResponseContent createVolume(Map config) { config == null ? null : (String) config.get("Name"), config == null ? null : (String) config.get("Driver"), config == null ? null : (Map) config.get("DriverOpts"), - config == null ? null : (Map) config.get("Labels"))); + config == null ? null : (Map) config.get("Labels"), + config == null ? null : (ClusterVolumeSpec) config.get("ClusterVolumeSpec"))); } @Override diff --git a/client/src/test/groovy/de/gesellix/docker/client/container/ManageContainerClientTest.groovy b/client/src/test/groovy/de/gesellix/docker/client/container/ManageContainerClientTest.groovy index a01061d12..6098c81be 100644 --- a/client/src/test/groovy/de/gesellix/docker/client/container/ManageContainerClientTest.groovy +++ b/client/src/test/groovy/de/gesellix/docker/client/container/ManageContainerClientTest.groovy @@ -213,7 +213,7 @@ class ManageContainerClientTest extends Specification { given: def execApi = Mock(ExecApi) client.execApi >> execApi - def execStartConfig = new ExecStartConfig(true, false) + def execStartConfig = new ExecStartConfig(true, false, null) def callback = Mock(StreamCallback) when: @@ -251,12 +251,12 @@ class ManageContainerClientTest extends Specification { then: 1 * execApi.containerExec("container-id", new ExecConfig(false, true, true, - null, false, + null, null, false, null, ["command", "line"], null, null, null)) >> idResponse then: 1 * execApi.execStart("exec-id", - new ExecStartConfig(false, false), + new ExecStartConfig(false, false, null), callback, 1000) and: exec.content == idResponse diff --git a/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy b/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy index c30de5942..2d8e9ca2e 100644 --- a/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy +++ b/client/src/test/groovy/de/gesellix/docker/client/stack/DeployConfigReaderTest.groovy @@ -562,6 +562,7 @@ class DeployConfigReaderTest extends Specification { Duration.of(2, ChronoUnit.MILLIS).toNanos().longValue(), Duration.of(30, ChronoUnit.SECONDS).toNanos().longValue(), 10, + null, null ) } @@ -575,6 +576,7 @@ class DeployConfigReaderTest extends Specification { null, null, null, + null, null ) } diff --git a/client/src/test/groovy/de/gesellix/docker/client/volume/ManageVolumeClientTest.groovy b/client/src/test/groovy/de/gesellix/docker/client/volume/ManageVolumeClientTest.groovy index 4c1b05c12..3e02bd19c 100644 --- a/client/src/test/groovy/de/gesellix/docker/client/volume/ManageVolumeClientTest.groovy +++ b/client/src/test/groovy/de/gesellix/docker/client/volume/ManageVolumeClientTest.groovy @@ -79,7 +79,7 @@ class ManageVolumeClientTest extends Specification { DriverOpts: [:]]) then: - 1 * volumeApi.volumeCreate(new VolumeCreateOptions("my-fancy-volume", "local", [:], null)) >> volumeResponse + 1 * volumeApi.volumeCreate(new VolumeCreateOptions("my-fancy-volume", "local", [:], null, null)) >> volumeResponse volume.content == volumeResponse } @@ -88,7 +88,7 @@ class ManageVolumeClientTest extends Specification { def volumeApi = Mock(VolumeApi) client.volumeApi >> volumeApi def volumeResponse = Mock(Volume) - def volumeConfig = new VolumeCreateOptions("my-volume", "local", [:], [:]) + def volumeConfig = new VolumeCreateOptions("my-volume", "local", [:], [:], null) when: def volume = service.createVolume(volumeConfig)