From abf35fc2dbde0ab46c370934d76605ff92dda9df Mon Sep 17 00:00:00 2001 From: Andy Pfister Date: Sun, 28 Jul 2024 14:10:28 +0200 Subject: [PATCH] Add a version check --- .github/workflows/ci.yml | 1 + test.ps1 | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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..99691e9 100644 --- a/test.ps1 +++ b/test.ps1 @@ -9,6 +9,19 @@ 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 +$result = $sqlcmdOutput | Select-String -Pattern "Microsoft SQL Server (\d+)" + +if ($result.Matches.Groups[1].Value -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 +} + Write-Output "Check status of connection encryption ..." $sqlQuery = @"