-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from gardleopard/upgrade_flag
upgrade support
- Loading branch information
Showing
6 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -457,6 +457,46 @@ class AWSBakeHandlerSpec extends Specification { | |
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$awsBakeryDefaults.templateFile") | ||
} | ||
|
||
void 'produces packer command with all required parameters including upgrade'() { | ||
setup: | ||
def imageNameFactoryMock = Mock(ImageNameFactory) | ||
def packerCommandFactoryMock = Mock(PackerCommandFactory) | ||
def bakeRequest = new BakeRequest(user: "[email protected]", | ||
package_name: PACKAGE_NAME, | ||
base_os: "ubuntu", | ||
vm_type: BakeRequest.VmType.hvm, | ||
cloud_provider_type: BakeRequest.CloudProviderType.aws, | ||
upgrade: true) | ||
def targetImageName = "kato-x8664-timestamp-ubuntu" | ||
def parameterMap = [ | ||
aws_access_key: awsBakeryDefaults.awsAccessKey, | ||
aws_secret_key: awsBakeryDefaults.awsSecretKey, | ||
aws_region: REGION, | ||
aws_ssh_username: "ubuntu", | ||
aws_instance_type: "t2.micro", | ||
aws_source_ami: SOURCE_UBUNTU_HVM_IMAGE_NAME, | ||
aws_target_ami: targetImageName, | ||
deb_repo: DEBIAN_REPOSITORY, | ||
packages: PACKAGE_NAME, | ||
upgrade: true, | ||
configDir: configDir | ||
] | ||
|
||
@Subject | ||
AWSBakeHandler awsBakeHandler = new AWSBakeHandler(configDir: configDir, | ||
awsBakeryDefaults: awsBakeryDefaults, | ||
imageNameFactory: imageNameFactoryMock, | ||
packerCommandFactory: packerCommandFactoryMock, | ||
debianRepository: DEBIAN_REPOSITORY) | ||
|
||
when: | ||
awsBakeHandler.producePackerCommand(REGION, bakeRequest) | ||
|
||
then: | ||
1 * imageNameFactoryMock.deriveImageNameAndAppVersion(bakeRequest, _) >> [targetImageName, null, PACKAGE_NAME] | ||
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, "$configDir/$awsBakeryDefaults.templateFile") | ||
} | ||
|
||
void 'throws exception when virtualization settings are not found for specified operating system'() { | ||
setup: | ||
def imageNameFactoryMock = Mock(ImageNameFactory) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters