diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6227083..8fee308 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,3 +60,4 @@ jobs: env: FORCE_ENCRYPTION: ${{ matrix.force-encryption }} SA_PASSWORD: "bHuZH81%cGC6" + VERSION: ${{ matrix.version }} diff --git a/test.ps1 b/test.ps1 index 61d01c6..f644ab3 100644 --- a/test.ps1 +++ b/test.ps1 @@ -9,6 +9,26 @@ else { Write-Output "Checking if SQL Server is available ..." & sqlcmd -S 127.0.0.1 -U sa -P $env:SA_PASSWORD -Q "SELECT 1" +Write-Output "Check if requested version was installed ..." +$sqlcmdOutput = & sqlcmd -S 127.0.0.1 -U sa -P $env:SA_PASSWORD -Q "SELECT @@VERSION" -h -1 + +if ($sqlcmdOutput -match "Microsoft SQL Server (\d+)\.") { + $majorVersion = [int]$matches[1] + if ($majorVersion -Eq $env:VERSION) { + Write-Output "Installled version matches expected version $env:VERSION" + } + else { + Write-Error "Installed version does not match expected version $env:VERSION" + Write-Error "sqlcmd output: $sqlcmdOutput" + exit 1 + } + +} +else { + Write-Error "Unable to extract SQL Server version!" + exit 1 +} + Write-Output "Check status of connection encryption ..." $sqlQuery = @"