-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Azure) Ensure 'azure_image_name' conforms to CaptureNamePrefix regex…
… in packer (#177)
- Loading branch information
1 parent
d5e73f2
commit 83a24bf
Showing
2 changed files
with
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,4 +331,34 @@ class AzureBakeHandlerSpec extends Specification implements TestDefaults{ | |
1 * imageNameFactoryMock.buildPackagesParameter(NUPKG_PACKAGE_TYPE, osPackages) >> NUPKG_PACKAGES_NAME | ||
1 * packerCommandFactoryMock.buildPackerCommand("", parameterMap, null, "$configDir/azure-windows-2012-r2.json") | ||
} | ||
|
||
void 'Create proper azure_image_name'() { | ||
setup: | ||
def azureBakeHandler = new AzureBakeHandler(azureBakeryDefaults: azureBakeryDefaults) | ||
|
||
when: | ||
def bakeRequest = new BakeRequest(user: "[email protected]", | ||
package_name: NUPKG_PACKAGES_NAME, | ||
base_os: "windows-2012-r2", | ||
cloud_provider_type: BakeRequest.CloudProviderType.azure, | ||
build_number: buildNumber, | ||
base_name: baseName) | ||
def azureVirtualizationSettings = azureBakeHandler.findVirtualizationSettings(REGION, bakeRequest) | ||
def parameterMap = azureBakeHandler.buildParameterMap(REGION, azureVirtualizationSettings, imageName, bakeRequest, "SomeVersion") | ||
|
||
then: | ||
parameterMap.azure_image_name == expectedAzureImageName | ||
|
||
where: | ||
buildNumber | baseName | imageName || expectedAzureImageName | ||
null | null | "namethatexceeds.23char.acters" || "namethatexceeds.23char" | ||
BUILD_NUMBER | BUILD_NAME | IMAGE_NAME || IMAGE_NAME | ||
BUILD_NUMBER | BUILD_NAME | null || IMAGE_NAME | ||
BUILD_NUMBER | null | IMAGE_NAME || IMAGE_NAME | ||
null | BUILD_NAME | IMAGE_NAME || IMAGE_NAME | ||
null | null | IMAGE_NAME || IMAGE_NAME | ||
null | null | "test-with!>#characters.morethan.23characters" || "test-withcharacters.mor" | ||
null | null | "test-with!>#characters..-." || "test-withcharacters" | ||
BUILD_NUMBER | BUILD_NAME | "this-is-a--test-withnamethatexceeds.23characters" || IMAGE_NAME | ||
} | ||
} |