Skip to content

Commit

Permalink
Adopt to the updated api-model
Browse files Browse the repository at this point in the history
See 3594851 (PR #562)
  • Loading branch information
gesellix committed Oct 3, 2023
1 parent 2e3c856 commit 1b8488d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class ManageContainerClient implements ManageContainer {
true,
true,
null,
null,
(execConfig.Tty ?: false) as Boolean,
null,
command,
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -72,7 +73,8 @@ public EngineResponseContent<Volume> createVolume(Map<String, Object> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Expand All @@ -575,6 +576,7 @@ class DeployConfigReaderTest extends Specification {
null,
null,
null,
null,
null
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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)
Expand Down

0 comments on commit 1b8488d

Please sign in to comment.