We run through this functionality in other tests already
@@ -21,78 +21,6 @@ import spock.lang.Requires
class DockerWorkflowFunctionalTest extends AbstractGroovyDslFunctionalTest {
- def "Can build an image, create, start, stop, and restart container"() {
- File imageDir = temporaryFolder.newFolder('images', 'minimal')
- createDockerfile(imageDir)
-
- String uniqueContainerName = createUniqueContainerName()
-
- buildFile << """
- import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
- import com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer
- import com.bmuschko.gradle.docker.tasks.container.DockerStartContainer
- import com.bmuschko.gradle.docker.tasks.container.DockerInspectContainer
- import com.bmuschko.gradle.docker.tasks.container.DockerRemoveContainer
- import com.bmuschko.gradle.docker.tasks.container.DockerStopContainer
- import com.bmuschko.gradle.docker.tasks.container.DockerRestartContainer
-
- task buildImage(type: DockerBuildImage) {
- inputDir = file('images/minimal')
- images.add("${createUniqueImageId()}")
- }
-
- task createContainer(type: DockerCreateContainer) {
- dependsOn buildImage
- targetImageId buildImage.getImageId()
- containerName = "$uniqueContainerName"
- hostConfig.portBindings = ['8080:8080']
- cmd = ['/bin/sh']
- }
-
- task startContainer(type: DockerStartContainer) {
- dependsOn createContainer
- targetContainerId createContainer.getContainerId()
- }
-
- task stopContainer(type: DockerStopContainer) {
- dependsOn startContainer
- waitTime = 3000
- targetContainerId startContainer.getContainerId()
- onError { exc ->
- if (!exc.message.contains('NotModifiedException')) {
- throw new RuntimeException(exc)
- }
- }
- }
-
- task restartContainer(type: DockerRestartContainer) {
- dependsOn stopContainer
- waitTime = 3000
- targetContainerId startContainer.getContainerId()
- }
-
- task inspectContainer(type: DockerInspectContainer) {
- dependsOn restartContainer
- targetContainerId startContainer.getContainerId()
- }
-
- task removeContainer(type: DockerRemoveContainer) {
- dependsOn inspectContainer
- removeVolumes = true
- force = true
- targetContainerId "$uniqueContainerName"
- }
-
- task workflow {
- dependsOn removeContainer
- }
- """
-
- expect:
- BuildResult result = build('workflow')
- result.output.contains("Name : /$uniqueContainerName")
- }
-
def "Can build an image, create and link a container"() {
File imageDir = temporaryFolder.newFolder('images', 'minimal')
createDockerfile(imageDir)
