Skip to content

Commit

Permalink
Adopt tests after docker-client update
Browse files Browse the repository at this point in the history
  • Loading branch information
gesellix committed Jan 31, 2022
1 parent 9726231 commit cdedd4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.gesellix.gradle.docker.tasks

import de.gesellix.docker.client.DockerClient
import de.gesellix.docker.client.EngineResponseContent
import de.gesellix.docker.remote.api.ContainerInspectResponse
import de.gesellix.docker.remote.api.core.ClientException
import org.gradle.testfixtures.ProjectBuilder
Expand All @@ -21,7 +22,7 @@ class DockerDisposeContainerTaskSpec extends Specification {
def "delegates to dockerClient (w/o removing the parent image)"() {
given:
task.containerId = "4712"
dockerClient.inspectContainer("4712") >> [content: new ContainerInspectResponse()]
dockerClient.inspectContainer("4712") >> new EngineResponseContent<>(new ContainerInspectResponse())
when:
task.dispose()
Expand All @@ -40,7 +41,7 @@ class DockerDisposeContainerTaskSpec extends Specification {
given:
task.containerId = "4712"
task.rmiParentImage = true
dockerClient.inspectContainer("4712") >> [content: new ContainerInspectResponse().tap { image = "an-image-id" }]
dockerClient.inspectContainer("4712") >> new EngineResponseContent<>(new ContainerInspectResponse().tap { image = "an-image-id" })
when:
task.dispose()
Expand Down Expand Up @@ -74,7 +75,7 @@ class DockerDisposeContainerTaskSpec extends Specification {
given:
task.containerId = "4712"
task.removeVolumes = true
dockerClient.inspectContainer("4712") >> [content: new ContainerInspectResponse()]
dockerClient.inspectContainer("4712") >> new EngineResponseContent<>(new ContainerInspectResponse())
when:
task.dispose()
Expand All @@ -86,7 +87,7 @@ class DockerDisposeContainerTaskSpec extends Specification {
def "does not remove Volumes by default"() {
given:
task.containerId = "4712"
dockerClient.inspectContainer("4712") >> [content: new ContainerInspectResponse()]
dockerClient.inspectContainer("4712") >> new EngineResponseContent<>(new ContainerInspectResponse())
when:
task.dispose()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package de.gesellix.gradle.docker.tasks

import de.gesellix.docker.client.DockerClient
import de.gesellix.docker.engine.EngineResponse
import de.gesellix.docker.client.EngineResponseContent
import de.gesellix.docker.remote.api.ContainerInspectResponse
import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Specification

Expand All @@ -20,7 +21,7 @@ class DockerInspectContainerTaskSpec extends Specification {
def "delegates to dockerClient and returns result"() {
given:
task.containerId = "4711"
def expectedResponse = new EngineResponse(content: ["container": "details"])
def expectedResponse = new EngineResponseContent(new ContainerInspectResponse().tap { id = "123" })

when:
task.inspect()
Expand Down

0 comments on commit cdedd4b

Please sign in to comment.