From 23ec14408aa8e08c0e67db38986338c51cde3b4e Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Fri, 3 Dec 2021 08:12:35 +0100
Subject: [PATCH 1/5] fix: arm inject newline chars on windows
---
.../Arcus.Scripting.ARM.psd1 | Bin 7612 -> 7580 bytes
.../Scripts/Inject-ArmContent.ps1 | 4 +-
.../Arcus.Scripting.ARM.tests.ps1 | 100 +++++++++---------
3 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/src/Arcus.Scripting.ARM/Arcus.Scripting.ARM.psd1 b/src/Arcus.Scripting.ARM/Arcus.Scripting.ARM.psd1
index e418050aaa13fd1aa36ca8444594504523ccce31..d19ef98d8905b1de511d08cf0c13570cae0fef3d 100644
GIT binary patch
delta 18
ZcmdmEJ;!>34HK&YgC2w7=0v7wX#h2~1l<4t
delta 16
XcmbPZy~lck4b$X35(b-nm;$5$H@5}A
diff --git a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1 b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
index 690516db..caf73ff9 100644
--- a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
+++ b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
@@ -62,7 +62,7 @@ function InjectFile {
# Replace newline characters with literal equivalents
if ([environment]::OSVersion.VersionString -like "*Windows*") {
- $newString = $newString -replace "`n", "\r\n"
+ $newString = $newString -replace "`r`n", "\r\n"
} else {
$newString = $newString -replace "`n", "\n"
}
@@ -106,7 +106,7 @@ function InjectFile {
$rawContents = Get-Content $filePath -Raw
$injectionInstructionRegex = [regex] '"?\${(.+)}\$"?';
- $injectionInstructionRegex.Replace($rawContents, $replaceContentDelegate) | Set-Content $filePath -Encoding UTF8
+ $injectionInstructionRegex.Replace($rawContents, $replaceContentDelegate) | Set-Content $filePath -NoNewline -Encoding UTF8
Write-Host "Done checking file $filePath"
}
diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.ARM.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.ARM.tests.ps1
index 4dc4f19c..c1295987 100644
--- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.ARM.tests.ps1
+++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.ARM.tests.ps1
@@ -1,56 +1,56 @@
Import-Module -Name $PSScriptRoot\..\Arcus.Scripting.ARM -ErrorAction Stop
-Describe "Arcus" {
- Context "ARM" {
- InModuleScope Arcus.Scripting.ARM {
- It "Replaces file path with inline file contents" {
- # Arrange
- $armTemplateFile = "$PSScriptRoot\Files\arm-template-inline.json"
- try {
- # Act
- Inject-ArmContent -Path $armTemplateFile
+InModuleScope Arcus.Scripting.ARM {
+ Describe "Arcus ARM integration tests" {
+ Context "ARM injection" {
+ It "Replaces file path with inline file contents" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-inline.json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
- # Assert
- $expected = Get-Content "$PSScriptRoot\Files\arm-template-inline-value.json"
- $actual = Get-Content $armTemplateFile
- $actual[7].Trim(' ') | Should -Match $expected
- } finally {
- $originalFile = "$PSScriptRoot\Files\arm-template-inline-org.json"
- Get-Content $originalFile | Out-File -FilePath $armTemplateFile
- }
- }
- It "Replaces file path with file contents as JSON object" {
- # Arrange
- $armTemplateFile = "$PSScriptRoot\Files\arm-template-object.json"
- try {
- # Act
- Inject-ArmContent -Path $armTemplateFile
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-inline-value.json"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "this is a test value",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-inline-org.json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ It "Replaces file path with file contents as JSON object" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-object.json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
- # Assert
- $expected = Get-Content "$PSScriptRoot\Files\arm-template-object-value.json"
- $actual = Get-Content $armTemplateFile
- $actual[7].Trim(' ') | Should -Match """value"": { ""test"": ""this is a test value"" }"
- } finally {
- $originalFile = "$PSScriptRoot\Files\arm-template-object-org.json"
- Get-Content $originalFile | Out-File -FilePath $armTemplateFile
- }
- }
- It "Replaces file path with file contents as escaped JSON and replaced special characters" {
- # Arrange
- $armTemplateFile = "$PSScriptRoot\Files\arm-template-escape.json"
- try {
- # Act
- Inject-ArmContent -Path $armTemplateFile
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-object-value.json"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "{\r\n \"test\": \"this is a test value\"\r\n}",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-object-org.json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ It "Replaces file path with file contents as escaped JSON and replaced special characters" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-escape.json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
- # Assert
- $expected = Get-Content "$PSScriptRoot\Files\arm-template-escape-value.xml"
- $actual = Get-Content $armTemplateFile
- $actual[7].Trim(' ') | Should -Match ""
- } finally {
- $originalFile = "$PSScriptRoot\Files\arm-template-escape-org.json"
- Get-Content $originalFile | Out-File -FilePath $armTemplateFile
- }
- }
- }
- }
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-escape-value.xml"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-escape-org.json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ }
+ }
}
\ No newline at end of file
From 617a5be3381257e1d75f02eb3caf39b670c9d16b Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Fri, 3 Dec 2021 08:48:27 +0100
Subject: [PATCH 2/5] pr-fix: revert package version insertion
---
.../Arcus.Scripting.ARM.psd1 | Bin 7580 -> 7612 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/src/Arcus.Scripting.ARM/Arcus.Scripting.ARM.psd1 b/src/Arcus.Scripting.ARM/Arcus.Scripting.ARM.psd1
index d19ef98d8905b1de511d08cf0c13570cae0fef3d..e418050aaa13fd1aa36ca8444594504523ccce31 100644
GIT binary patch
delta 16
XcmbPZy~lck4b$X35(b-nm;$5$H@5}A
delta 18
ZcmdmEJ;!>34HK&YgC2w7=0v7wX#h2~1l<4t
From 70a32898a8aae38891fb25c8ed058b471a1707e2 Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Fri, 3 Dec 2021 08:51:49 +0100
Subject: [PATCH 3/5] pr-fix: update with separate linux/windows integration
tests
---
.../Scripts/Inject-ArmContent.ps1 | 252 +++++++++---------
.../Arcus.Scripting.ARM.tests.ps1 | 129 +++++----
.../Arcus.Scripting.Tests.Integration.pssproj | 219 +++++++--------
.../Files/arm-template-inline-value.json | 2 +-
.../Files/arm-template-object (linux).json | Bin 0 -> 900 bytes
...son => arm-template-object (windows).json} | Bin 912 -> 932 bytes
...n => arm-template-object-org (linux).json} | 2 +-
.../arm-template-object-org (windows).json | 14 +
.../arm-template-object-value (linux).json | 3 +
.../arm-template-object-value (windows).json | 3 +
.../Files/arm-template-object-value.json | 1 -
11 files changed, 333 insertions(+), 292 deletions(-)
create mode 100644 src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (linux).json
rename src/Arcus.Scripting.Tests.Integration/Files/{arm-template-object.json => arm-template-object (windows).json} (90%)
rename src/Arcus.Scripting.Tests.Integration/Files/{arm-template-object-org.json => arm-template-object-org (linux).json} (90%)
create mode 100644 src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (windows).json
create mode 100644 src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (linux).json
create mode 100644 src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (windows).json
delete mode 100644 src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value.json
diff --git a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1 b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
index caf73ff9..3b3f7e3d 100644
--- a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
+++ b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
@@ -1,127 +1,127 @@
-<#
- Possible injection instructions in ARM templates or recursively referenced files:
-
- ${ fileToInject.xml }
- ${ FileToInject=file.xml }
- ${ FileToInject = ".\Parent Directory\file.xml" }
- ${ FileToInject = ".\Parent Directory\file.xml", EscapeJson, ReplaceSpecialChars }
- ${ FileToInject = '.\Parent Directory\file.json', InjectAsJsonObject }
- #>
-
-param (
- [string] $Path = $PSScriptRoot
-)
-
-function InjectFile {
- param(
- [string] $filePath
- )
-
- Write-Host "Checking file $filePath"
-
- $replaceContentDelegate = {
- param($match)
-
- $completeInjectionInstruction = $match.Groups[1].Value;
- $instructionParts = @($completeInjectionInstruction -split "," | foreach { $_.Trim() } )
-
- $filePart = $instructionParts[0];
- # Regex uses non-capturing group for 'FileToInject' part,
- # afterwards character classes and backreferencing to select the optional single or double quotes
- $fileToInjectPathRegex = [regex] "^(?:FileToInject\s*=\s*)?([`"`']?)(?.*?)\1?$";
- $fileMatch = $fileToInjectPathRegex.Match($filePart)
- if ($fileMatch.Success -ne $True){
- throw "The file part '$filePart' of the injection instruction could not be parsed correctly"
- }
-
- $relativePathOfFileToInject = $fileMatch.Groups["File"];
- $fullPathOfFileToInject = Join-Path (Split-Path $filePath -Parent) $relativePathOfFileToInject
- $fileToInjectIsFound = Test-Path -Path $fullPathOfFileToInject -PathType Leaf
- if ($false -eq $fileToInjectIsFound) {
- throw "No file can be found at '$fullPathofFileToInject'"
- }
-
- # Inject content recursively first
- InjectFile($fullPathOfFileToInject)
-
- Write-Host "`t Injecting content of $fullPathOfFileToInject into $filePath"
-
- $newString = Get-Content -Path $fullPathOfFileToInject -Raw
-
- # XML declaration can only appear on the first line of an XML document, so remove when injecting
- $newString = $newString -replace '(<\?xml).+(\?>)(\r)?(\n)?', ""
-
- # By default: retain double quotes around content-to-inject, if present
- $surroundContentWithDoubleQuotes = $match.Value.StartsWith('"') -and $match.Value.EndsWith('"')
-
- if ($instructionParts.Length -gt 1) {
- $optionParts = $instructionParts | select -Skip 1
-
- if ($optionParts.Contains("ReplaceSpecialChars")){
- Write-Host "`t Replacing special characters"
-
- # Replace newline characters with literal equivalents
- if ([environment]::OSVersion.VersionString -like "*Windows*") {
- $newString = $newString -replace "`r`n", "\r\n"
- } else {
- $newString = $newString -replace "`n", "\n"
- }
-
- # Replace tabs with spaces
- $newString = $newString -replace "`t", " "
-
- # Replace " with \"
- $newString = $newString -replace """", "\"""
- }
-
- if ($optionParts.Contains("EscapeJson")) {
- Write-Host "`t JSON-escaping file content"
-
- # Use regex negative lookbehind to replace double quotes not preceded by a backslash with escaped quotes
- $newString = $newString -replace '(?
+
+param (
+ [string] $Path = $PSScriptRoot
+)
+
+function InjectFile {
+ param(
+ [string] $filePath
+ )
+
+ Write-Host "Checking file $filePath"
+
+ $replaceContentDelegate = {
+ param($match)
+
+ $completeInjectionInstruction = $match.Groups[1].Value;
+ $instructionParts = @($completeInjectionInstruction -split "," | foreach { $_.Trim() } )
+
+ $filePart = $instructionParts[0];
+ # Regex uses non-capturing group for 'FileToInject' part,
+ # afterwards character classes and backreferencing to select the optional single or double quotes
+ $fileToInjectPathRegex = [regex] "^(?:FileToInject\s*=\s*)?([`"`']?)(?.*?)\1?$";
+ $fileMatch = $fileToInjectPathRegex.Match($filePart)
+ if ($fileMatch.Success -ne $True){
+ throw "The file part '$filePart' of the injection instruction could not be parsed correctly"
+ }
+
+ $relativePathOfFileToInject = $fileMatch.Groups["File"];
+ $fullPathOfFileToInject = Join-Path (Split-Path $filePath -Parent) $relativePathOfFileToInject
+ $fileToInjectIsFound = Test-Path -Path $fullPathOfFileToInject -PathType Leaf
+ if ($false -eq $fileToInjectIsFound) {
+ throw "No file can be found at '$fullPathofFileToInject'"
+ }
+
+ # Inject content recursively first
+ InjectFile($fullPathOfFileToInject)
+
+ Write-Host "`t Injecting content of $fullPathOfFileToInject into $filePath"
+
+ $newString = Get-Content -Path $fullPathOfFileToInject -Raw
+
+ # XML declaration can only appear on the first line of an XML document, so remove when injecting
+ $newString = $newString -replace '(<\?xml).+(\?>)(\r)?(\n)?', ""
+
+ # By default: retain double quotes around content-to-inject, if present
+ $surroundContentWithDoubleQuotes = $match.Value.StartsWith('"') -and $match.Value.EndsWith('"')
+
+ if ($instructionParts.Length -gt 1) {
+ $optionParts = $instructionParts | select -Skip 1
+
+ if ($optionParts.Contains("ReplaceSpecialChars")){
+ Write-Host "`t Replacing special characters"
+
+ # Replace newline characters with literal equivalents
+ if ([Environment]::OSVersion.VersionString -like "*Windows*") {
+ $newString = $newString -replace "`r`n", "\r\n"
+ } else {
+ $newString = $newString -replace "`n", "\n"
+ }
+
+ # Replace tabs with spaces
+ $newString = $newString -replace "`t", " "
+
+ # Replace " with \"
+ $newString = $newString -replace """", "\"""
+ }
+
+ if ($optionParts.Contains("EscapeJson")) {
+ Write-Host "`t JSON-escaping file content"
+
+ # Use regex negative lookbehind to replace double quotes not preceded by a backslash with escaped quotes
+ $newString = $newString -replace '(?",'
- } finally {
- $originalFile = "$PSScriptRoot\Files\arm-template-escape-org.json"
- Get-Content $originalFile | Out-File -FilePath $armTemplateFile
- }
- }
- }
- }
+Import-Module -Name $PSScriptRoot\..\Arcus.Scripting.ARM -ErrorAction Stop
+
+InModuleScope Arcus.Scripting.ARM {
+ Describe "Arcus ARM integration tests" {
+ Context "ARM injection" {
+ It "Replaces file path with inline file contents" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-inline.json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
+
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-inline-value.json"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "this is a test value",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-inline-org.json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ if ([Environment]::OSVersion.VersionString -like "*Windows*") {
+ It "Replaces file path with file contents as JSON object (windows)" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-object (windows).json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
+
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-object-value (windows).json"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "{\r\n \"test\": \"this is a test value\"\r\n}",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-object-org (windows).json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ } else {
+ It "Replaces file path with file contents as JSON object (linux)" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-object (linux).json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
+
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-object-value (linux).json"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "{\n \"test\": \"this is a test value\"\n}",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-object-org (linux).json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ }
+ It "Replaces file path with file contents as escaped JSON and replaced special characters" {
+ # Arrange
+ $armTemplateFile = "$PSScriptRoot\Files\arm-template-escape.json"
+ try {
+ # Act
+ Inject-ArmContent -Path $armTemplateFile
+
+ # Assert
+ $expected = Get-Content "$PSScriptRoot\Files\arm-template-escape-value.xml"
+ $actual = Get-Content $armTemplateFile
+ $actual[7] | Should -Be ' "value": "",'
+ } finally {
+ $originalFile = "$PSScriptRoot\Files\arm-template-escape-org.json"
+ Get-Content $originalFile | Out-File -FilePath $armTemplateFile
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj
index 336232ec..96eaf304 100644
--- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj
+++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj
@@ -1,109 +1,112 @@
-
-
- Debug
- 2.0
- {ba3ff06c-cefc-403d-bccb-82ae90452b89}
- Exe
- MyApplication
- MyApplication
- Arcus.Scripting.Tests.Integration
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Arcus.Scripting.ARM
- {5499ba14-07a1-40ff-b7b4-17b19e4c9dbe}
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Debug
+ 2.0
+ {ba3ff06c-cefc-403d-bccb-82ae90452b89}
+ Exe
+ MyApplication
+ MyApplication
+ Arcus.Scripting.Tests.Integration
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Arcus.Scripting.ARM
+ {5499ba14-07a1-40ff-b7b4-17b19e4c9dbe}
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-inline-value.json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-inline-value.json
index 3fae2469..e2f54591 100644
--- a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-inline-value.json
+++ b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-inline-value.json
@@ -1 +1 @@
-"this is a test value"
\ No newline at end of file
+this is a test value
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (linux).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (linux).json
new file mode 100644
index 0000000000000000000000000000000000000000..19ae1796e2f9125590a042a9d1f1304c065bd7b1
GIT binary patch
literal 900
zcmbW0PfNo<5XIlwPZ3HX3O4?^DR}5bP^bkdUP=$OO>3l0Ym!z)`qkCn>}G3=;6cJ>
zvpa9*&Agd>eSYXb5l=&v-nCT9*QGmmlxd_w3ze)1_C#$EnK~LOXH7xRSvj^7P$}rO
z^GZ1n9kwLi@s`89%p-90VOZcl;=a-$9z$YyOy%O0+{SVr>)jw5ObpZ75fQJ@H$mmZy#uOr9WP*Lfib2f-j+ei&4Oxze~TFjj1k?P!IQ)PM*k8}Hf?#`
z!(HAsmfPCe-H8`zqvo%wCPcApEQ3&2saMWZH@5{@1+GRtpPQ|M_BR+Zbf=-d%i6jz
igxhrSli90rHhueZVtQMrbNW=O%kJ~&*K7m!4eJ|K@r_>q
literal 0
HcmV?d00001
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object.json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (windows).json
similarity index 90%
rename from src/Arcus.Scripting.Tests.Integration/Files/arm-template-object.json
rename to src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (windows).json
index 08e32cc93627f00d56b39bc909241523e55912d8..afd2673c6b93084343cff74a781f393c5df37400 100644
GIT binary patch
delta 32
mcmbQhzJz^4ACs^Gg9bx6LncEWLkdGakX6i}xw)5#nGpbj;|Ev(
delta 12
TcmZ3&K7oBhAJgVVOiYXb9cTmH
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org.json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (linux).json
similarity index 90%
rename from src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org.json
rename to src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (linux).json
index baa3beec..0bc16d13 100644
--- a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org.json
+++ b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (linux).json
@@ -5,7 +5,7 @@
"properties": {
"subscriptionRequired": true,
"path": "demo",
- "value": "${ FileToInject='./../Files/arm-template-object-value.json', InjectAsJsonObject }$",
+ "value": "${ FileToInject='./../Files/arm-template-object-value (linux).json', InjectAsJsonObject }$",
"format": "swagger-json"
},
"tags": "[variables('Tags')]",
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (windows).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (windows).json
new file mode 100644
index 00000000..da0b91bb
--- /dev/null
+++ b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-org (windows).json
@@ -0,0 +1,14 @@
+{
+ "type": "Microsoft.ApiManagement/service/apis",
+ "name": "[concat(parameters('ApiManagement.Name'),'/', parameters('ApiManagement.Api.Name'))]",
+ "apiVersion": "2019-01-01",
+ "properties": {
+ "subscriptionRequired": true,
+ "path": "demo",
+ "value": "${ FileToInject='./../Files/arm-template-object-value (windows).json', ReplaceSpecialChars, InjectAsJsonObject }$",
+ "format": "swagger-json"
+ },
+ "tags": "[variables('Tags')]",
+ "dependsOn": [
+ ]
+}
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (linux).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (linux).json
new file mode 100644
index 00000000..2862a79e
--- /dev/null
+++ b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (linux).json
@@ -0,0 +1,3 @@
+{
+ "test": "this is a test value"
+}
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (windows).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (windows).json
new file mode 100644
index 00000000..849aa382
--- /dev/null
+++ b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value (windows).json
@@ -0,0 +1,3 @@
+{
+ "test": "this is a test value"
+}
\ No newline at end of file
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value.json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value.json
deleted file mode 100644
index 5fc0e148..00000000
--- a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object-value.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "test": "this is a test value" }
\ No newline at end of file
From 2e6987c72029200be996c1c75f265c0e2e0d6435 Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Fri, 3 Dec 2021 09:41:05 +0100
Subject: [PATCH 4/5] pr-fix: update with replace special chars
---
.../Files/arm-template-object (linux).json | Bin 900 -> 942 bytes
.../Files/arm-template-object (windows).json | Bin 932 -> 974 bytes
2 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (linux).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (linux).json
index 19ae1796e2f9125590a042a9d1f1304c065bd7b1..cb578f388037afebc45f2ae5c35e5aa8704c3697 100644
GIT binary patch
delta 49
ycmZo+U&p>-0h4MFLn=c7Lk>eCLo$#R3}mMQS(!k74udm829PddD4sl<=_LRwY79RB
delta 11
ScmZ3--on0N0n_ADOiutB(*)K4
diff --git a/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (windows).json b/src/Arcus.Scripting.Tests.Integration/Files/arm-template-object (windows).json
index afd2673c6b93084343cff74a781f393c5df37400..42612e1dab837b74e897526024ad83516d45ab42 100644
GIT binary patch
delta 49
ycmZ3&evW;^CMMM&hE#?Eh8%`OhGZZs7|2cqvND1E90q5G3?N;^P&|1p({}(m#tg9l
delta 11
TcmX@dzJz_lCZ@@Em_7jj9s>nP
From f6071fca372773c7936b1a07797e53341949cb86 Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Fri, 3 Dec 2021 09:56:53 +0100
Subject: [PATCH 5/5] pr-fix: update to warning and not stop the script
---
.../Scripts/Inject-ArmContent.ps1 | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1 b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
index 3b3f7e3d..f1a60157 100644
--- a/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
+++ b/src/Arcus.Scripting.ARM/Scripts/Inject-ArmContent.ps1
@@ -57,7 +57,7 @@ function InjectFile {
if ($instructionParts.Length -gt 1) {
$optionParts = $instructionParts | select -Skip 1
- if ($optionParts.Contains("ReplaceSpecialChars")){
+ if ($optionParts.Contains("ReplaceSpecialChars")) {
Write-Host "`t Replacing special characters"
# Replace newline characters with literal equivalents
@@ -81,21 +81,21 @@ function InjectFile {
$newString = $newString -replace '(?