diff --git a/arm-ttk/testcases/deploymentTemplate/Virtual-Machines-Should-Not-Be-Preview.test.ps1 b/arm-ttk/testcases/deploymentTemplate/Virtual-Machines-Should-Not-Be-Preview.test.ps1 index 6ca22d5b..0c20dd6f 100644 --- a/arm-ttk/testcases/deploymentTemplate/Virtual-Machines-Should-Not-Be-Preview.test.ps1 +++ b/arm-ttk/testcases/deploymentTemplate/Virtual-Machines-Should-Not-Be-Preview.test.ps1 @@ -26,7 +26,7 @@ foreach ($sp in $storageProfiles) { if ($storageProfile.imageReference -like '*preview' -or ` $storageProfile.imageReference.version -like '*preview' -or ` $storageProfile.imageReference.sku -like '*preview' -or ` - $storageProfile.imageReference.offer -like '*preview*') { + $storageProfile.imageReference.offer -like '*preview') { Write-Error "StorageProfile for resource '$($sp.ParentObject.Name)' must not use a preview version" -TargetObject $sp -ErrorId VM.Using.Preview.Image } } diff --git a/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-offer.json b/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-offer.json index 26d12b74..95792adb 100644 --- a/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-offer.json +++ b/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Fail/Latest-Preview-offer.json @@ -7,10 +7,10 @@ "properties": { "storageProfile": { "imageReference": { - "publisher": "Canonical", + "publisher": "TestPublisher", "version": "latest", - "offer": "UbuntuServer_preview", - "sku": "16.04-LTS" + "offer": "test-offer-preview", + "sku": "standard" } } } diff --git a/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Pass/offer-with-preview-in-name.json b/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Pass/offer-with-preview-in-name.json new file mode 100644 index 00000000..0274dced --- /dev/null +++ b/unit-tests/Virtual-Machines-Should-Not-Be-Preview/Pass/offer-with-preview-in-name.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2019-12-01", + "properties": { + "storageProfile": { + "imageReference": { + "publisher": "TestPublisher", + "version": "latest", + "offer": "product-preview-edition", + "sku": "standard" + } + } + } + } + ] +}