Skip to content

Commit

Permalink
Removing the handling of the docker service from the DockerBakeHandler (
Browse files Browse the repository at this point in the history
  • Loading branch information
brujoand authored and Matt Duftler committed Jun 23, 2016
1 parent df8d619 commit 47d4471
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public class DockerBakeHandler extends CloudProviderBakeHandler {
private static final String BUILDER_TYPE = "docker"
private static final String IMAGE_NAME_TOKEN = "Repository:"

static final String START_DOCKER_SERVICE_BASE_COMMAND = "sudo service docker start ; "

@Autowired
RoscoDockerConfiguration.DockerBakeryDefaults dockerBakeryDefaults

Expand Down Expand Up @@ -74,11 +72,6 @@ public class DockerBakeHandler extends CloudProviderBakeHandler {
]
}

@Override
String getBaseCommand() {
return START_DOCKER_SERVICE_BASE_COMMAND
}

@Override
String getTemplateFileName() {
return dockerBakeryDefaults.templateFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ class DockerBakeHandlerSpec extends Specification {

then:
1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME]
1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND,
parameterMap,
"$configDir/$dockerBakeryDefaults.templateFile")
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile")
}

void 'produces packer command with all required parameters for trusty'() {
Expand Down Expand Up @@ -210,9 +208,7 @@ class DockerBakeHandlerSpec extends Specification {

then:
1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME]
1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND,
parameterMap,
"$configDir/$dockerBakeryDefaults.templateFile")
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile")
}

void 'produces packer command with all required parameters for centos'() {
Expand Down Expand Up @@ -246,9 +242,7 @@ class DockerBakeHandlerSpec extends Specification {

then:
1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGES_NAME]
1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND,
parameterMap,
"$configDir/$dockerBakeryDefaults.templateFile")
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile")
}

void 'produces packer command with all required parameters including appversion and build_host for trusty'() {
Expand Down Expand Up @@ -289,9 +283,7 @@ class DockerBakeHandlerSpec extends Specification {
then:
1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >>
[targetImageName, appVersionStr, fullyQualifiedPackageName]
1 * packerCommandFactoryMock.buildPackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND,
parameterMap,
"$configDir/$dockerBakeryDefaults.templateFile")
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$dockerBakeryDefaults.templateFile")
}

void 'throws exception when virtualization settings are not found for specified operating system'() {
Expand All @@ -310,7 +302,7 @@ class DockerBakeHandlerSpec extends Specification {
debianRepository: DEBIAN_REPOSITORY)

when:
dockerBakeHandler.producePackerCommand(DockerBakeHandler.START_DOCKER_SERVICE_BASE_COMMAND, bakeRequest)
dockerBakeHandler.producePackerCommand(REGION, bakeRequest)

then:
IllegalArgumentException e = thrown()
Expand Down

0 comments on commit 47d4471

Please sign in to comment.