Skip to content

Commit 321bbd4

Browse files
Add integration test for database env var MSSQL_DB (#18)
1 parent e6d09d2 commit 321bbd4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/tests.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,20 @@ jobs:
3434
run: |
3535
$null = Invoke-Pester ./tests/actions.ps1 -Output Detailed -PassThru
3636
Get-DbatoolsError -All
37+
38+
- name: Remove containers
39+
run: docker rm -vf mssql1 mssql2
40+
41+
- name: Recreate the scenario from the env PR
42+
run: |
43+
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet --env MSSQL_DB=mydb1 -d dbatools/sqlinstance
44+
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet --env MSSQL_DB=mydb2 -d dbatools/sqlinstance2
45+
sleep 20
46+
47+
- name: Test that commands continue to work with new build
48+
run: |
49+
$password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
50+
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password
51+
52+
Get-DbaDatabase -SqlInstance localhost -SqlCredential $cred -Database mydb1 | Should -Not -BeNullOrEmpty
53+
Get-DbaDatabase -SqlInstance localhost:14333 -SqlCredential $cred -Database mydb2 | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)