Test case updates

This commit is contained in:
Kevin Rowlandson 2020-07-03 12:23:40 +01:00
parent 801ae0bec6
commit fb613ea619
No known key found for this signature in database
GPG key ID: F33348ACAE26BE84
4 changed files with 130 additions and 43 deletions

View file

@ -1,10 +1,53 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "",
"apiProfile": "",
"parameters": { },
"variables": { },
"functions": [ ],
"resources": [ ],
"outputs": { }
"parameters": {
"Network.Config": {
"type": "object",
"metadata": {
"description": "Properties object for the Virtual Network"
}
}
},
"variables": {
"Network.Name": "[parameters('Network.Config').name]",
"Network.Location": "[parameters('Network.Config').location]",
"Network.Tags": "[parameters('Network.Config').tags]",
"Network.Properties.AddressSpace.AddressPrefixes": "[parameters('Network.Config').addressPrefixes]",
"Network.Properties.DhcpOptions.DnsServers": "[parameters('Network.Config').dnsServers]",
"copy": [
{
"name": "Network.Properties.Subnets",
"count": "[length(parameters('Network.Config').subnetConfig)]",
"input": {
"name": "[concat(parameters('Network.Config').subnetConfig[copyIndex('Network.Properties.Subnets')].aksId,'-',parameters('Network.Config').locationId)]",
"properties": "[parameters('Network.Config').subnetConfig[copyIndex('Network.Properties.Subnets')].properties]"
}
}
],
"Test.Blank.Variable": []
},
"resources": [
{
"name": "[variables('Network.Name')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2019-12-01",
"tags": "[variables('Network.Tags')]",
"properties": {
"addressSpace": {
"addressPrefixes": "[variables('Network.Properties.AddressSpace.AddressPrefixes')]"
},
"dhcpOptions": {
"dnsServers": "[variables('Network.Properties.DhcpOptions.DnsServers')]"
},
"subnets": "[variables('Network.Properties.Subnets')]"
}
}
],
"outputs": {
"state": {
"type": "object",
"value": "[reference(resourceId('Microsoft.Network/virtualNetworks',variables('Network.Name')), '2019-12-01', 'Full')]"
}
}
}

View file

@ -1,9 +1,53 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"functions": [ ],
"resources": [ ],
"outputs": { }
"parameters": {
"Network.Config": {
"type": "object",
"metadata": {
"description": "Properties object for the Virtual Network"
}
}
},
"variables": {
"Network.Name": "[parameters('Network.Config').name]",
"Network.Location": "[parameters('Network.Config').location]",
"Network.Tags": "[parameters('Network.Config').tags]",
"Network.Properties.AddressSpace.AddressPrefixes": "[parameters('Network.Config').addressPrefixes]",
"Network.Properties.DhcpOptions.DnsServers": "[parameters('Network.Config').dnsServers]",
"copy": [
{
"name": "Network.Properties.Subnets",
"count": "[length(parameters('Network.Config').subnetConfig)]",
"input": {
"name": "[concat(parameters('Network.Config').subnetConfig[copyIndex('Network.Properties.Subnets')].aksId,'-',parameters('Network.Config').locationId)]",
"properties": "[parameters('Network.Config').subnetConfig[copyIndex('Network.Properties.Subnets')].properties]"
}
}
]
},
"resources": [
{
"name": "[variables('Network.Name')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2019-12-01",
"location": "[variables('Network.Location')]",
"tags": "[variables('Network.Tags')]",
"properties": {
"addressSpace": {
"addressPrefixes": "[variables('Network.Properties.AddressSpace.AddressPrefixes')]"
},
"dhcpOptions": {
"dnsServers": "[variables('Network.Properties.DhcpOptions.DnsServers')]"
},
"subnets": "[variables('Network.Properties.Subnets')]"
}
}
],
"outputs": {
"state": {
"type": "object",
"value": "[reference(resourceId('Microsoft.Network/virtualNetworks',variables('Network.Name')), '2019-12-01', 'Full')]"
}
}
}

View file

@ -2,29 +2,29 @@
# - Test Parameters: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit#test-parameters
# - Test Cases: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-cases
@{
Test = @(
'Parameters Property Must Exist',
'Parameters Must Be Referenced',
'Secure String Parameters Cannot Have Default',
'Location Should Not Be Hardcoded',
'Resources Should Have Location',
'VM Size Should Be A Parameter',
'Min And Max Value Are Numbers',
'artifacts-parameter',
'Variables Must Be Referenced',
'Dynamic Variable References Should Not Use Concat',
'apiVersions Should Be Recent',
'Providers apiVersions Is Not Permitted',
'Template Should Not Contain Blanks',
'IDs Should Be Derived From ResourceIDs',
'ResourceIds should not contain',
'DependsOn Must Not Be Conditional',
'Deployment Resources Must Not Be Debug',
'adminUsername Should Not Be A Literal',
'VM Images Should Use Latest Version',
'Virtual-Machines-Should-Not-Be-Preview',
'ManagedIdentityExtension must not be used',
'Outputs Must Not Contain Secrets'
)
Skip = @()
# Test = @(
# 'Parameters Property Must Exist',
# 'Parameters Must Be Referenced',
# 'Secure String Parameters Cannot Have Default',
# 'Location Should Not Be Hardcoded',
# 'Resources Should Have Location',
# 'VM Size Should Be A Parameter',
# 'Min And Max Value Are Numbers',
# 'artifacts-parameter',
# 'Variables Must Be Referenced',
# 'Dynamic Variable References Should Not Use Concat',
# 'apiVersions Should Be Recent',
# 'Providers apiVersions Is Not Permitted',
# 'Template Should Not Contain Blanks',
# 'IDs Should Be Derived From ResourceIDs',
# 'ResourceIds should not contain',
# 'DependsOn Must Not Be Conditional',
# 'Deployment Resources Must Not Be Debug',
# 'adminUsername Should Not Be A Literal',
# 'VM Images Should Use Latest Version',
# 'Virtual-Machines-Should-Not-Be-Preview',
# 'ManagedIdentityExtension must not be used',
# 'Outputs Must Not Contain Secrets'
# )
# Skip = @()
}

View file

@ -269,7 +269,7 @@ GetLinterVersions()
# Get the version #
###################
if [[ "$LINTER" == "arm-ttk" ]]; then
mapfile -t GET_VERSION_CMD < <(cat $ARM_TTK_PSD1 | grep -i version | xargs 2>&1)
mapfile -t GET_VERSION_CMD < <(cat "$ARM_TTK_PSD1" | grep -i version | xargs 2>&1)
elif [[ "$LINTER" == "protolint" ]]; then
mapfile -t GET_VERSION_CMD < <(echo "--version not supported")