From 6d7444601b32645378183e24bec4b37aeac15dd1 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Thu, 13 Oct 2022 14:21:46 -0500 Subject: [PATCH] 704 (#705) Co-authored-by: azure-quickstart-templates pipeline --- ...d-Be-Recent-In-Reference-Functions.test.ps1 | 11 ++++++++++- .../Pass/bicep.json | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/bicep.json diff --git a/arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent-In-Reference-Functions.test.ps1 b/arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent-In-Reference-Functions.test.ps1 index 64eb8090..2a245e5e 100644 --- a/arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent-In-Reference-Functions.test.ps1 +++ b/arm-ttk/testcases/deploymentTemplate/apiVersions-Should-Be-Recent-In-Reference-Functions.test.ps1 @@ -28,9 +28,18 @@ param( # Test Run Date - date to use when doing comparisons, if not current date (used for unit testing against and old cache) [Parameter(Mandatory = $false, Position = 3)] [datetime] - $TestDate = [DateTime]::Now + $TestDate = [DateTime]::Now, + + [Parameter(Mandatory = $true)] + [PSCustomObject] + $TemplateMetadata ) + # bicep - if this is a bicep file, skip since the apiVersions are implicit (most of the time) + if( $TemplateMetadata._generator.name -eq 'bicep') { + continue + } + $foundReferences = $TemplateText | ? -FunctionName 'reference|list\w{0,}' diff --git a/unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/bicep.json b/unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/bicep.json new file mode 100644 index 00000000..0804a239 --- /dev/null +++ b/unit-tests/apiVersions-Should-Be-Recent-In-Reference-Functions/Pass/bicep.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.5.6.12127", + "templateHash": "16815708176905569328" + } + }, + "parameters": {}, + "functions": [], + "variables": {}, + "resources": [], + "outputs": { + "oldIPReference": "[reference(resourceId('Microsoft.Network/publicIPAddresses', 'test'), '2015-06-15', 'Full')]" + } +} \ No newline at end of file