From 4270f1e1db5fe3e76a03f0ca4f35d7ae3944720f Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 11:53:52 +0100 Subject: [PATCH 01/20] chore: run tests on linux and windows --- build/ci-build.yml | 58 ++++++++++++++++++++------------------- build/variables/build.yml | 5 +++- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index a0591f9a..6f8c1189 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -40,7 +40,7 @@ stages: jobs: - job: Compile pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Image.Default)' steps: - task: qetza.replacetokens.replacetokens-task.replacetokens@3 displayName: 'Replace package version tokens' @@ -72,38 +72,40 @@ stages: dependsOn: Build condition: succeeded() jobs: - - job: RunUnitTests - displayName: 'Run unit tests' - pool: - vmImage: '$(Vm.Image)' - steps: - - task: DownloadPipelineArtifact@2 - displayName: 'Download build artifacts' - inputs: - artifact: 'Build' - path: '$(Build.SourcesDirectory)' - - template: 'templates/run-pester-tests.yml' - parameters: - projectName: '$(Project).Tests.Unit' + - ${{ each image in $(Vm.Images) }}: + - job: RunUnitTests + displayName: 'Run unit tests' + pool: + vmImage: '${{ image }}' + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download build artifacts' + inputs: + artifact: 'Build' + path: '$(Build.SourcesDirectory)' + - template: 'templates/run-pester-tests.yml' + parameters: + projectName: '$(Project).Tests.Unit' - stage: IntegrationTests displayName: Integration Tests dependsOn: Build condition: succeeded() jobs: - - job: RunIntegrationTests - displayName: 'Run integration tests' - pool: - vmImage: '$(Vm.Image)' - steps: - - task: DownloadPipelineArtifact@2 - displayName: 'Download build artifacts' - inputs: - artifact: 'Build' - path: '$(Build.SourcesDirectory)' - - template: 'templates/run-pester-tests.yml' - parameters: - projectName: '$(Project).Tests.Integration' + - ${{ each image in $(Vm.Images) }}: + - job: RunIntegrationTests + displayName: 'Run integration tests' + pool: + vmImage: '${{ image }}' + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download build artifacts' + inputs: + artifact: 'Build' + path: '$(Build.SourcesDirectory)' + - template: 'templates/run-pester-tests.yml' + parameters: + projectName: '$(Project).Tests.Integration' - stage: ReleaseToMyget displayName: 'Release to MyGet' @@ -115,7 +117,7 @@ stages: - job: PushToMyGet displayName: 'Push to MyGet' pool: - vmImage: 'windows-2019' + vmImage: '$(Vm.Image.Default)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' diff --git a/build/variables/build.yml b/build/variables/build.yml index bac7e2ab..726a1ae3 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -1,4 +1,7 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' - Vm.Image: 'ubuntu-latest' \ No newline at end of file + Vm.Image.Default: 'ubuntu-latest' + Vm.Images: + - 'ubuntu-latest' + - 'windows-latest' \ No newline at end of file From d6466286eca5fcf1950bd0cd7d9144a3695f1ae1 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:02:17 +0100 Subject: [PATCH 02/20] pr-fix: update with correct multiple var group --- build/ci-build.yml | 4 ++-- build/variables/build.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index 6f8c1189..afebc91f 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -72,7 +72,7 @@ stages: dependsOn: Build condition: succeeded() jobs: - - ${{ each image in $(Vm.Images) }}: + - ${{ each image in variables['Vm.Images'] }}: - job: RunUnitTests displayName: 'Run unit tests' pool: @@ -92,7 +92,7 @@ stages: dependsOn: Build condition: succeeded() jobs: - - ${{ each image in $(Vm.Images) }}: + - ${{ each image in variables['Vm.Images'] }}: - job: RunIntegrationTests displayName: 'Run integration tests' pool: diff --git a/build/variables/build.yml b/build/variables/build.yml index 726a1ae3..5db385f5 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -2,6 +2,6 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' Vm.Image.Default: 'ubuntu-latest' - Vm.Images: - - 'ubuntu-latest' - - 'windows-latest' \ No newline at end of file + Vm.Images: | + 'ubuntu-latest' + 'windows-latest' \ No newline at end of file From 4ed17dd8e4b38af6550f3c324d4a5ddb779377d0 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:14:17 +0100 Subject: [PATCH 03/20] pr-fix: update with correct array def --- build/variables/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/variables/build.yml b/build/variables/build.yml index 5db385f5..f965df85 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -2,6 +2,4 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' Vm.Image.Default: 'ubuntu-latest' - Vm.Images: | - 'ubuntu-latest' - 'windows-latest' \ No newline at end of file + Vm.Images: [ 'ubuntu-latest', 'windows-latest' ] \ No newline at end of file From a8baaf725805012bd1d6fb6cf6c28721e6e80725 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:16:46 +0100 Subject: [PATCH 04/20] pr-fix: update with correct array def --- build/variables/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/variables/build.yml b/build/variables/build.yml index f965df85..6df63141 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -2,4 +2,4 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' Vm.Image.Default: 'ubuntu-latest' - Vm.Images: [ 'ubuntu-latest', 'windows-latest' ] \ No newline at end of file + Vm.Images: [ "ubuntu-latest", "windows-latest" ] \ No newline at end of file From 3ea8097b08855e81ba96e681757e240213259bb8 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:27:42 +0100 Subject: [PATCH 05/20] pr-fix: update with correct array def --- build/variables/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/variables/build.yml b/build/variables/build.yml index 6df63141..93e39d1a 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -2,4 +2,4 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' Vm.Image.Default: 'ubuntu-latest' - Vm.Images: [ "ubuntu-latest", "windows-latest" ] \ No newline at end of file + Vm.Images: { "ubuntu-latest", "windows-latest" } \ No newline at end of file From 08be2ffb6986201bc39b72e785ad835e2dcc6725 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:56:11 +0100 Subject: [PATCH 06/20] pr-fix: update with correct array def --- build/variables/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/variables/build.yml b/build/variables/build.yml index 93e39d1a..30f736e8 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -2,4 +2,5 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' Vm.Image.Default: 'ubuntu-latest' - Vm.Images: { "ubuntu-latest", "windows-latest" } \ No newline at end of file + - name: 'Vm.Images' + values: { "ubuntu-latest", "windows-latest" } \ No newline at end of file From 280327512ef3c12af643f3b2af9be40d0f186129 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 13:05:59 +0100 Subject: [PATCH 07/20] pr-fix: update with strategy in job --- build/ci-build.yml | 60 +++++++++++++++++++++------------------ build/variables/build.yml | 4 +-- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index afebc91f..29637b80 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -72,40 +72,44 @@ stages: dependsOn: Build condition: succeeded() jobs: - - ${{ each image in variables['Vm.Images'] }}: - - job: RunUnitTests - displayName: 'Run unit tests' - pool: - vmImage: '${{ image }}' - steps: - - task: DownloadPipelineArtifact@2 - displayName: 'Download build artifacts' - inputs: - artifact: 'Build' - path: '$(Build.SourcesDirectory)' - - template: 'templates/run-pester-tests.yml' - parameters: - projectName: '$(Project).Tests.Unit' + - job: RunUnitTests + displayName: 'Run unit tests' + pool: + vmImage: '$(Vm.Image)' + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download build artifacts' + inputs: + artifact: 'Build' + path: '$(Build.SourcesDirectory)' + - template: 'templates/run-pester-tests.yml' + parameters: + projectName: '$(Project).Tests.Unit' - stage: IntegrationTests displayName: Integration Tests dependsOn: Build condition: succeeded() jobs: - - ${{ each image in variables['Vm.Images'] }}: - - job: RunIntegrationTests - displayName: 'Run integration tests' - pool: - vmImage: '${{ image }}' - steps: - - task: DownloadPipelineArtifact@2 - displayName: 'Download build artifacts' - inputs: - artifact: 'Build' - path: '$(Build.SourcesDirectory)' - - template: 'templates/run-pester-tests.yml' - parameters: - projectName: '$(Project).Tests.Integration' + - job: RunIntegrationTests + displayName: 'Run integration tests' + strategy: + matrix: + linux: + imageName: 'ubuntu-latest' + windows: + imageName: 'windows-latest' + pool: + vmImage: '$(imageName)' + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download build artifacts' + inputs: + artifact: 'Build' + path: '$(Build.SourcesDirectory)' + - template: 'templates/run-pester-tests.yml' + parameters: + projectName: '$(Project).Tests.Integration' - stage: ReleaseToMyget displayName: 'Release to MyGet' diff --git a/build/variables/build.yml b/build/variables/build.yml index 30f736e8..bac7e2ab 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -1,6 +1,4 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' - Vm.Image.Default: 'ubuntu-latest' - - name: 'Vm.Images' - values: { "ubuntu-latest", "windows-latest" } \ No newline at end of file + Vm.Image: 'ubuntu-latest' \ No newline at end of file From 7df3faf983de21c678af41d7589e355545099a4c Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 13:07:41 +0100 Subject: [PATCH 08/20] pr-fix: update with strategy in job --- build/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index 29637b80..dc1ebef1 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -40,7 +40,7 @@ stages: jobs: - job: Compile pool: - vmImage: '$(Vm.Image.Default)' + vmImage: '$(Vm.Image)' steps: - task: qetza.replacetokens.replacetokens-task.replacetokens@3 displayName: 'Replace package version tokens' From 9082d5371d266747b31a55e1695061f2f99de234 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 13:17:12 +0100 Subject: [PATCH 09/20] pr-fix: update with allow glober installing ps modules --- build/ci-build.yml | 9 +++++---- build/psgallery-release.yml | 15 +++++++++++---- build/templates/run-pester-tests.yml | 2 +- build/variables/build.yml | 3 ++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index dc1ebef1..b1187cfd 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -75,7 +75,7 @@ stages: - job: RunUnitTests displayName: 'Run unit tests' pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Linux.Image)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' @@ -94,11 +94,12 @@ stages: - job: RunIntegrationTests displayName: 'Run integration tests' strategy: + maxParallel: 1 matrix: linux: - imageName: 'ubuntu-latest' + imageName: '$(Vm.Linux.Image)' windows: - imageName: 'windows-latest' + imageName: '$(Vm.Windows.Image)' pool: vmImage: '$(imageName)' steps: @@ -121,7 +122,7 @@ stages: - job: PushToMyGet displayName: 'Push to MyGet' pool: - vmImage: '$(Vm.Image.Default)' + vmImage: '$(Vm.Linux.Image)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' diff --git a/build/psgallery-release.yml b/build/psgallery-release.yml index 466d350f..8fca759f 100644 --- a/build/psgallery-release.yml +++ b/build/psgallery-release.yml @@ -35,7 +35,7 @@ stages: jobs: - job: Compile pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Linux.Image)' steps: - task: qetza.replacetokens.replacetokens-task.replacetokens@3 displayName: 'Replace package version tokens' @@ -79,7 +79,7 @@ stages: - job: RunUnitTests displayName: 'Run unit tests' pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Linux.Image)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' @@ -97,8 +97,15 @@ stages: jobs: - job: RunIntegrationTests displayName: 'Run integration tests' + strategy: + maxParallel: 1 + matrix: + linux: + imageName: '$(Vm.Linux.Image)' + windows: + imageName: '$(Vm.Windows.Image)' pool: - vmImage: '$(Vm.Image)' + vmImage: '$(imageName)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' @@ -119,7 +126,7 @@ stages: - job: PushToNuGet displayName: 'Push to PowerShell Gallery' pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Linux.Image)' variables: ${{ if ne(variables['Prerelease'], 'none') }}: Package.Version: "${{ parameters['Package.Version'] }}${{ parameters['Prerelease'] }}" diff --git a/build/templates/run-pester-tests.yml b/build/templates/run-pester-tests.yml index d563bf44..18960672 100644 --- a/build/templates/run-pester-tests.yml +++ b/build/templates/run-pester-tests.yml @@ -31,7 +31,7 @@ steps: $content.RequiredModules | where { $_.ModuleName -ne $null -and $_.ModuleName -notlike 'Arcus.Scripting.*' -and $_.ModuleVersion -ne "#{Package.Version}#" } | % { Write-Host "Install $($_.ModuleName) module $($_.ModuleVersion)" - Install-Module $_.ModuleName -MaximumVersion $_.ModuleVersion -Force -SkipPublisherCheck } } + Install-Module $_.ModuleName -MaximumVersion $_.ModuleVersion -AllowClobber -Force -SkipPublisherCheck } } Install-Module -Name Az -Force -SkipPublisherCheck -MaximumVersion 5.6.0 Install-Module -Name AzTable -Force -SkipPublisherCheck -MaximumVersion 2.1.0 Write-Host "Done installing, start importing modules" diff --git a/build/variables/build.yml b/build/variables/build.yml index bac7e2ab..0a4a0b7e 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -1,4 +1,5 @@ variables: DotNet.Sdk.Version: '2.2.105' Project: 'Arcus.Scripting' - Vm.Image: 'ubuntu-latest' \ No newline at end of file + Vm.Linux.Image: 'ubuntu-latest' + Vm.Windows.Image: 'windows-latest' \ No newline at end of file From ac638cccb37d253a51527c59f88f2daecdc2881e Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 13:23:24 +0100 Subject: [PATCH 10/20] pr-fix: update w correct vm image on build --- build/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index b1187cfd..491713ea 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -40,7 +40,7 @@ stages: jobs: - job: Compile pool: - vmImage: '$(Vm.Image)' + vmImage: '$(Vm.Linux.Image)' steps: - task: qetza.replacetokens.replacetokens-task.replacetokens@3 displayName: 'Replace package version tokens' From 006ef6297d2863aae696d327b7f80717834b090e Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:44:01 +0100 Subject: [PATCH 11/20] pr-temp: check windows latest --- build/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index 491713ea..7d59e326 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -99,7 +99,7 @@ stages: linux: imageName: '$(Vm.Linux.Image)' windows: - imageName: '$(Vm.Windows.Image)' + imageName: 'windows-latest' pool: vmImage: '$(imageName)' steps: From 2e63200b18793317f4f608c63dbf5277de5acb71 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:48:59 +0100 Subject: [PATCH 12/20] pr-fix: don't use variable in strategy.matrix variable definition --- build/ci-build.yml | 2 +- build/psgallery-release.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index 7d59e326..4958e1ad 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -97,7 +97,7 @@ stages: maxParallel: 1 matrix: linux: - imageName: '$(Vm.Linux.Image)' + imageName: 'ubuntu-latest' windows: imageName: 'windows-latest' pool: diff --git a/build/psgallery-release.yml b/build/psgallery-release.yml index 8fca759f..0d2e3dbc 100644 --- a/build/psgallery-release.yml +++ b/build/psgallery-release.yml @@ -101,9 +101,9 @@ stages: maxParallel: 1 matrix: linux: - imageName: '$(Vm.Linux.Image)' + imageName: 'ubuntu-latest' windows: - imageName: '$(Vm.Windows.Image)' + imageName: 'windows-latest' pool: vmImage: '$(imageName)' steps: From e16636e8a06f4ec0ea5e1fa02b0358e750cf797c Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:51:03 +0100 Subject: [PATCH 13/20] pr-fix: update with `-AllowClobber` on installing dependent ps modules --- build/templates/run-pester-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/templates/run-pester-tests.yml b/build/templates/run-pester-tests.yml index 18960672..c3beb4fd 100644 --- a/build/templates/run-pester-tests.yml +++ b/build/templates/run-pester-tests.yml @@ -32,7 +32,7 @@ steps: where { $_.ModuleName -ne $null -and $_.ModuleName -notlike 'Arcus.Scripting.*' -and $_.ModuleVersion -ne "#{Package.Version}#" } | % { Write-Host "Install $($_.ModuleName) module $($_.ModuleVersion)" Install-Module $_.ModuleName -MaximumVersion $_.ModuleVersion -AllowClobber -Force -SkipPublisherCheck } } - Install-Module -Name Az -Force -SkipPublisherCheck -MaximumVersion 5.6.0 + Install-Module -Name Az -Force -AllowClobber -SkipPublisherCheck -MaximumVersion 5.6.0 Install-Module -Name AzTable -Force -SkipPublisherCheck -MaximumVersion 2.1.0 Write-Host "Done installing, start importing modules" displayName: 'Install Pester test framework and Az required modules' From 280154431df54f88821cdeb82ae5d174dfc845d2 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 07:59:28 +0100 Subject: [PATCH 14/20] pr-fix: update with cross-platform support --- .../Scripts/Set-AzKeyVaultSecretFromFile.ps1 | 5 +- ...cus.Scripting.IntegrationAccount.tests.ps1 | 50 ++++++++----------- .../Arcus.Scripting.KeyVault.tests.ps1 | 20 ++++---- .../Arcus.Scripting.Tests.Integration.pssproj | 2 +- src/Arcus.Scripting.sln | 6 +++ 5 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/Arcus.Scripting.KeyVault/Scripts/Set-AzKeyVaultSecretFromFile.ps1 b/src/Arcus.Scripting.KeyVault/Scripts/Set-AzKeyVaultSecretFromFile.ps1 index 2442f252..c9b91f84 100644 --- a/src/Arcus.Scripting.KeyVault/Scripts/Set-AzKeyVaultSecretFromFile.ps1 +++ b/src/Arcus.Scripting.KeyVault/Scripts/Set-AzKeyVaultSecretFromFile.ps1 @@ -17,8 +17,9 @@ Write-Verbose "Creating Azure Key Vault secret from file..." $secretValue = $null if ($Base64) { Write-Verbose "Use BASE64 format as secret format" - $content = Get-Content $filePath -AsByteStream -Raw - $contentBase64 = [System.Convert]::ToBase64String($content) + $content = Get-Content $filePath -Raw + $bytes = [System.Text.Encoding]::UTF8.GetBytes($content) + $contentBase64 = [System.Convert]::ToBase64String($bytes) $secretValue = ConvertTo-SecureString -String $contentBase64 -Force -AsPlainText } else { $rawContent = Get-Content $FilePath -Raw diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.IntegrationAccount.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.IntegrationAccount.tests.ps1 index 5520870b..18067584 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.IntegrationAccount.tests.ps1 +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.IntegrationAccount.tests.ps1 @@ -17,23 +17,18 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = "unexisting-integration-account" - $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" + $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" $schema = Get-ChildItem($schemaFilePath) -File # Act - { - Set-AzIntegrationAccountSchemas -ResourceGroupName $resourceGroupName -Name $integrationAccountName -SchemaFilePath $schema.FullName -ErrorAction Stop - } | Should -Throw - - # Assert - Assert-VerifiableMock - Assert-MockCalled Set-AzKeyVaultSecret -Times 0 + { Set-AzIntegrationAccountSchemas -ResourceGroupName $resourceGroupName -Name $integrationAccountName -SchemaFilePath $schema.FullName -ErrorAction Stop } | + Should -Throw } It "Create a single schema in an Integration Account" { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" + $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" $schema = Get-ChildItem($schemaFilePath) -File $expectedSchemaName = $schema.Name $executionDateTime = (Get-Date).ToUniversalTime() @@ -56,7 +51,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" + $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" $schema = Get-ChildItem($schemaFilePath) -File $expectedSchemaName = $schema.Name $executionDateTime = (Get-Date).ToUniversalTime() @@ -82,7 +77,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" + $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" $schema = Get-ChildItem($schemaFilePath) -File $expectedSchemaName = $schema.BaseName $executionDateTime = (Get-Date).ToUniversalTime() @@ -105,7 +100,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" + $schemaFilePath = "$PSScriptRoot\Files\IntegrationAccount\Schemas\NestedSchema.xsd" $schema = Get-ChildItem($schemaFilePath) -File $artifactsPrefix = "dev-" $expectedSchemaName = $artifactsPrefix + $schema.BaseName @@ -129,7 +124,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" + $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" $executionDateTime = (Get-Date).ToUniversalTime() try { @@ -158,7 +153,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" + $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" $executionDateTime = (Get-Date).ToUniversalTime() try { @@ -187,7 +182,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" + $schemasFolder = "$PSScriptRoot\Files\IntegrationAccount\Schemas" $artifactsPrefix = "dev-" $executionDateTime = (Get-Date).ToUniversalTime() @@ -219,23 +214,18 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = "unexisting-integration-account" - $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" + $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" $map = Get-ChildItem($mapFilePath) -File # Act - { - Set-AzIntegrationAccountMaps -ResourceGroupName $resourceGroupName -Name $integrationAccountName -MapFilePath $map.FullName -ErrorAction Stop - } | Should -Throw - - # Assert - Assert-VerifiableMock - Assert-MockCalled Set-AzKeyVaultSecret -Times 0 + { Set-AzIntegrationAccountMaps -ResourceGroupName $resourceGroupName -Name $integrationAccountName -MapFilePath $map.FullName -ErrorAction Stop} | + Should -Throw } It "Create a single map in an Integration Account" { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" + $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" $map = Get-ChildItem($mapFilePath) -File $expectedMapName = $map.Name $executionDateTime = (Get-Date).ToUniversalTime() @@ -258,7 +248,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" + $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" $map = Get-ChildItem($mapFilePath) -File $expectedMapName = $map.Name $executionDateTime = (Get-Date).ToUniversalTime() @@ -284,7 +274,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" + $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" $map = Get-ChildItem($mapFilePath) -File $expectedMapName = $map.BaseName $executionDateTime = (Get-Date).ToUniversalTime() @@ -307,7 +297,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" + $mapFilePath = "$PSScriptRoot\Files\IntegrationAccount\Maps\BankTransfer_CSV-to-BankTransfer_Canonical.xslt" $map = Get-ChildItem($mapFilePath) -File $artifactsPrefix = "dev-" $expectedMapName = $artifactsPrefix + $map.BaseName @@ -331,7 +321,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" + $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" $executionDateTime = (Get-Date).ToUniversalTime() try { @@ -360,7 +350,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" + $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" $executionDateTime = (Get-Date).ToUniversalTime() try { @@ -389,7 +379,7 @@ InModuleScope Arcus.Scripting.IntegrationAccount { # Arrange $resourceGroupName = $config.Arcus.ResourceGroupName $integrationAccountName = $config.Arcus.IntegrationAccount.Name - $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" + $mapsFolder = "$PSScriptRoot\Files\IntegrationAccount\Maps" $artifactsPrefix = "dev-" $executionDateTime = (Get-Date).ToUniversalTime() diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.KeyVault.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.KeyVault.tests.ps1 index 3fafc423..cc37e8ff 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.KeyVault.tests.ps1 +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.KeyVault.tests.ps1 @@ -30,12 +30,11 @@ InModuleScope Arcus.Scripting.KeyVault { } } It "Set secret as BASE64 in Key Vault" { - $contents = [System.Guid]::NewGuid().ToString() - $file = New-Item -Path "test-base64-file.txt" -ItemType File -Value $contents + # Arrange + $expected = [System.Guid]::NewGuid().ToString() + $file = New-Item -Path "test-base64-file.txt" -ItemType File -Value $expected + $secretName = "Arcus-Scripting-KeyVault-MySecret-$([System.Guid]::NewGuid())" try { - # Arrange - $secretName = "Arcus-Scripting-KeyVault-MySecret-$([System.Guid]::NewGuid())" - # Act Set-AzKeyVaultSecretAsBase64FromFile -KeyVaultName $config.Arcus.KeyVault.VaultName -SecretName $secretName -FilePath $file.FullName @@ -43,7 +42,7 @@ InModuleScope Arcus.Scripting.KeyVault { $actual = Get-AzKeyVaultSecret -VaultName $config.Arcus.KeyVault.VaultName -Name $secretName -AsPlainText [System.Convert]::FromBase64String($actual) | % { [System.Text.Encoding]::UTF8.GetString($_) } | - Should -Be $contents.ToCharArray() + Should -Be $expected.ToCharArray() } finally { Remove-Item -Path $file.FullName Remove-AzKeyVaultSecret -VaultName $config.Arcus.KeyVault.VaultName -Name $secretName -PassThru -Force @@ -71,14 +70,13 @@ InModuleScope Arcus.Scripting.KeyVault { } It "Set secret as BASE64 in Key Vault with expiration date" { # Arrange - $contents = [System.Guid]::NewGuid().ToString() - $file = New-Item -Path "test-file.txt" -ItemType File -Value $contents + $expected = [System.Guid]::NewGuid().ToString() + $file = New-Item -Path "test-base64-file.txt" -ItemType File -Value $expected $secretName = "Arcus-Scripting-KeyVault-MySecret-$([System.Guid]::NewGuid())" $expirationDate = (Get-Date).AddDays(7).ToUniversalTime() $expirationDate = $expirationDate.AddTicks(-$expirationDate.Ticks) - try - { + try { # Act Set-AzKeyVaultSecretAsBase64FromFile -KeyVaultName $config.Arcus.KeyVault.VaultName -SecretName $secretName -Expires $expirationDate -FilePath $file.FullName @@ -88,7 +86,7 @@ InModuleScope Arcus.Scripting.KeyVault { $actual = Get-AzKeyVaultSecret -VaultName $config.Arcus.KeyVault.VaultName -Name $secretName -AsPlainText [System.Convert]::FromBase64String($actual) | % { [System.Text.Encoding]::UTF8.GetString($_) } | - Should -Be $contents.ToCharArray() + Should -Be $expected.ToCharArray() } finally { Remove-Item -Path $file.FullName 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 d2cf880a..c72c33b1 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj @@ -84,4 +84,4 @@ - + \ No newline at end of file diff --git a/src/Arcus.Scripting.sln b/src/Arcus.Scripting.sln index b255050a..a8ffce90 100644 --- a/src/Arcus.Scripting.sln +++ b/src/Arcus.Scripting.sln @@ -35,6 +35,8 @@ Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Arcus.Scripting.Storage.All EndProject Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Arcus.Scripting.All", "Arcus.Scripting.All\Arcus.Scripting.All.pssproj", "{A3FD9C88-5283-40BB-81D0-44708C8313D8}" EndProject +Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Arcus.Scripting.IntegrationAccount", "Arcus.Scripting.IntegrationAccount\Arcus.Scripting.IntegrationAccount.pssproj", "{AFCEA845-372E-4000-85FD-5672D7551527}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -101,6 +103,10 @@ Global {A3FD9C88-5283-40BB-81D0-44708C8313D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3FD9C88-5283-40BB-81D0-44708C8313D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3FD9C88-5283-40BB-81D0-44708C8313D8}.Release|Any CPU.Build.0 = Release|Any CPU + {AFCEA845-372E-4000-85FD-5672D7551527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFCEA845-372E-4000-85FD-5672D7551527}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFCEA845-372E-4000-85FD-5672D7551527}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFCEA845-372E-4000-85FD-5672D7551527}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 4d90a0abca06ec17fbc0eeb82b2de08b40c0d208 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 08:42:14 +0100 Subject: [PATCH 15/20] pr-fix: add integration account maps to integration test project --- .../Arcus.Scripting.Tests.Integration.pssproj | 3 +++ 1 file changed, 3 insertions(+) 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 c72c33b1..b1fb8b1a 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj @@ -50,6 +50,7 @@ + @@ -76,6 +77,8 @@ + + From 7a00d05a83adf4895f0182db4c41a00d304b3be5 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 08:51:04 +0100 Subject: [PATCH 16/20] pr-fix: add sql files to integration test project and prepare for win supoort --- .../Arcus.Scripting.Sql.tests.ps1 | 28 +++++++++---------- .../Arcus.Scripting.Tests.Integration.pssproj | 19 +++++++++++++ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 index d04661df..048929b5 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 @@ -24,11 +24,11 @@ function global:Get-AzSqlDatabaseVersion ($params, $schema = "dbo") { $row = Run-AzSqlQuery $params "SELECT TOP 1 MajorVersionNumber, MinorVersionNumber, PatchVersionNumber FROM [$schema].[DatabaseVersion] ORDER BY MajorVersionNumber DESC, MinorVersionNumber DESC, PatchVersionNumber DESC" $version = [DatabaseVersion]::new() - if (($null -ne $row) -and ($null -ne $row.ItemArray) -and ($row.ItemArray.Length -ge 3) ) { + if (($null -ne $row) -and ($null -ne $row.ItemArray) -and ($row.ItemArray.Length -ge 3) ) { $version = [DatabaseVersion]::new( - [convert]::ToInt32($row.ItemArray[0]), - [convert]::ToInt32($row.ItemArray[1]), - [convert]::ToInt32($row.ItemArray[2])) + [convert]::ToInt32($row.ItemArray[0]), + [convert]::ToInt32($row.ItemArray[1]), + [convert]::ToInt32($row.ItemArray[2])) } return $version @@ -49,7 +49,7 @@ function global:Create-MigrationTable ($params) { " [MigrationDescription] [nvarchar](256) NOT NULL, " + " [MigrationDate] DATETIME NOT NULL " + " CONSTRAINT [PK_DatabaseVersion] PRIMARY KEY CLUSTERED ([MajorVersionNumber],[MinorVersionNumber],[PatchVersionNumber]) " + - " WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) " + + " WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) " + ")" Run-AzSqlCommand $params $createTable @@ -99,7 +99,7 @@ InModuleScope Arcus.Scripting.Sql { # avoid having timeout errors during the test themselves. try { Write-Host "Execute dummy SQL statement to make sure the Azure SQL DB is resumed." - Invoke-Sqlcmd @params -Query "SELECT TOP 1 FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose + Invoke-Sqlcmd @params -Query "SELECT TOP 1 FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue } catch { # We don't care if an exception is thrown; we just want to 'activate' the Azure SQL database @@ -125,7 +125,7 @@ InModuleScope Arcus.Scripting.Sql { $version = Get-AzSqlDatabaseVersion $params $version.MajorVersionNumber | Should -Be 1 $version.MinorVersionNumber | Should -Be 0 - $version.PatchVersionNumber | Should -Be 0 + $version.PatchVersionNumber | Should -Be 0 } It "Invoke first SQL migration with custom schema on empty database creates new DataVersion table with custom schema" { # Arrange @@ -189,7 +189,7 @@ InModuleScope Arcus.Scripting.Sql { $version = Get-AzSqlDatabaseVersion $params $version.MajorVersionNumber | Should -Be 1 $version.MinorVersionNumber | Should -Be 0 - $version.PatchVersionNumber | Should -Be 0 + $version.PatchVersionNumber | Should -Be 0 } } Context "Migrations - Happy Path" { @@ -216,14 +216,14 @@ InModuleScope Arcus.Scripting.Sql { # we have inserted a record in the DatabaseVersion-table which indicates that this version/migration-file was already # executed. If the Invoke-AzSqlDatabaseMigration script runs correctly, it should skip the migration-file with version 0.0.1 # which means that the table 'NonExistingTable' should not exist in the DB. - # If it does exist in the DB, then it means that the 0.0.1 migration-script was executed anyway. + # If it does exist in the DB, then it means that the 0.0.1 migration-script was executed anyway. $result = TableExists $params 'NonExistingTable' $result | Should -Be $false -Because 'DatabaseVersion was initialized with version that introduced this table, so script should not have been executed' # A migration-script in the MigrationScriptsAreSuccessfullyExecuted folder contains a migration-file # that creates the Customer table. # However, there also exists a migration-script with a higher version in that folder which renames the - # Customer table to 'Person'. This means that the Customer table should not exist anymore. + # Customer table to 'Person'. This means that the Customer table should not exist anymore. $result = TableExists $params 'Customer' $result | Should -Be $false -Because 'Customer table should have been renamed' @@ -311,14 +311,14 @@ InModuleScope Arcus.Scripting.Sql { ) for ($i = 0; $i -lt $versions.Length; $i++) { - AssertDatabaseVersion $versions[$i] $expectedVersions[$i] - } + AssertDatabaseVersion $versions[$i] $expectedVersions[$i] + } } - finally { + finally { Drop-AzSqlDatabaseTable $params "Person" Drop-AzSqlDatabaseTable $params "Customer" } - } + } } } } 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 b1fb8b1a..336232ec 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj @@ -54,6 +54,10 @@ + + + + @@ -83,6 +87,21 @@ + + + + + + + + + + + + + + + From 9af3b6369c00de85b0a254100f466fe9b47e16d3 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 09:20:27 +0100 Subject: [PATCH 17/20] pr-prop: runtime variable declaration --- build/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/ci-build.yml b/build/ci-build.yml index 4958e1ad..6be75b05 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -97,9 +97,9 @@ stages: maxParallel: 1 matrix: linux: - imageName: 'ubuntu-latest' + imageName: ${{ variables['Vm.Linux.Image']}} windows: - imageName: 'windows-latest' + imageName: ${{ variables['Vm.Windows.Image']}} pool: vmImage: '$(imageName)' steps: From 9da7e8c29b6b3cf22888f3085fa2293f224a5073 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 09:23:09 +0100 Subject: [PATCH 18/20] pr-fix: update release pipeline with runtime vars --- build/psgallery-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/psgallery-release.yml b/build/psgallery-release.yml index 0d2e3dbc..5654da7a 100644 --- a/build/psgallery-release.yml +++ b/build/psgallery-release.yml @@ -101,9 +101,9 @@ stages: maxParallel: 1 matrix: linux: - imageName: 'ubuntu-latest' + imageName: ${{ variables['Vm.Linux.Image']}} windows: - imageName: 'windows-latest' + imageName: ${{ variables['Vm.Windows.Image']}} pool: vmImage: '$(imageName)' steps: From fb24a476f1cdc49a93579b17558ce08eeffadc82 Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 10:19:27 +0100 Subject: [PATCH 19/20] pr-sug: remove try/catch for warming up sql connection --- .../Arcus.Scripting.Sql.tests.ps1 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 index 048929b5..670a0414 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 @@ -97,13 +97,9 @@ InModuleScope Arcus.Scripting.Sql { # Try to open a connection to the SQL database, so that the # Azure Database that can be paused, is starting up. This should # avoid having timeout errors during the test themselves. - try { - Write-Host "Execute dummy SQL statement to make sure the Azure SQL DB is resumed." - Invoke-Sqlcmd @params -Query "SELECT TOP 1 FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue - } - catch { - # We don't care if an exception is thrown; we just want to 'activate' the Azure SQL database - } + # We don't care if an exception is thrown; we just want to 'activate' the Azure SQL database + Write-Host "Execute dummy SQL statement to make sure the Azure SQL DB is resumed." + Invoke-Sqlcmd @params -Query "SELECT TOP 1 FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue } AfterEach { Drop-AzSqlDatabaseTable $params "DatabaseVersion" From 696955330ea9676556c6f8be01c0059c94b61fad Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 18 Nov 2021 10:54:11 +0100 Subject: [PATCH 20/20] pr-fix: update with correct sql statement --- .../Arcus.Scripting.Sql.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 index 670a0414..5dc8c235 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 @@ -99,7 +99,7 @@ InModuleScope Arcus.Scripting.Sql { # avoid having timeout errors during the test themselves. # We don't care if an exception is thrown; we just want to 'activate' the Azure SQL database Write-Host "Execute dummy SQL statement to make sure the Azure SQL DB is resumed." - Invoke-Sqlcmd @params -Query "SELECT TOP 1 FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue + Invoke-Sqlcmd @params -Query "SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue } AfterEach { Drop-AzSqlDatabaseTable $params "DatabaseVersion"