diff --git a/build/ci-build.yml b/build/ci-build.yml index a0591f9a..6be75b05 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' @@ -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' @@ -93,8 +93,15 @@ stages: jobs: - job: RunIntegrationTests displayName: 'Run integration tests' + strategy: + maxParallel: 1 + matrix: + linux: + imageName: ${{ variables['Vm.Linux.Image']}} + windows: + imageName: ${{ variables['Vm.Windows.Image']}} pool: - vmImage: '$(Vm.Image)' + vmImage: '$(imageName)' steps: - task: DownloadPipelineArtifact@2 displayName: 'Download build artifacts' @@ -115,7 +122,7 @@ stages: - job: PushToMyGet displayName: 'Push to MyGet' pool: - vmImage: 'windows-2019' + 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..5654da7a 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: ${{ variables['Vm.Linux.Image']}} + windows: + imageName: ${{ variables['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..c3beb4fd 100644 --- a/build/templates/run-pester-tests.yml +++ b/build/templates/run-pester-tests.yml @@ -31,8 +31,8 @@ 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 -Name Az -Force -SkipPublisherCheck -MaximumVersion 5.6.0 + Install-Module $_.ModuleName -MaximumVersion $_.ModuleVersion -AllowClobber -Force -SkipPublisherCheck } } + 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' 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 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.Sql.tests.ps1 b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Sql.tests.ps1 index d04661df..5dc8c235 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 @@ -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 - } - 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 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" -ConnectionTimeout 60 -Verbose -ErrorAction SilentlyContinue } AfterEach { Drop-AzSqlDatabaseTable $params "DatabaseVersion" @@ -125,7 +121,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 +185,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 +212,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 +307,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 d2cf880a..336232ec 100644 --- a/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj +++ b/src/Arcus.Scripting.Tests.Integration/Arcus.Scripting.Tests.Integration.pssproj @@ -50,9 +50,14 @@ + + + + + @@ -76,12 +81,29 @@ + + + + + + + + + + + + + + + + + - + \ 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