Skip to content

Commit cd401ef

Browse files
Scale VMSS to 6 instances
Introduces new jobs to the integration test workflow for scaling Azure VMSS instances, running SQL Server tests on self-hosted Windows runners, and cleaning up by scaling down the VMSS. This enables parallelized integration testing using dynamically provisioned Azure resources.
1 parent a06b67f commit cd401ef

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/integration-tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,80 @@ defaults:
2525
shell: pwsh
2626

2727
jobs:
28+
azure-vmss-tests:
29+
name: Azure VMSS Tests
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Azure Login
33+
uses: azure/login@v1
34+
with:
35+
creds: ${{ secrets.AZURE_CREDENTIALS }}
36+
37+
- name: Scale VMSS to 6 instances
38+
run: |
39+
echo "Scaling VMSS to 6 instances..."
40+
az vmss scale \
41+
--name dbatools-runner-vmss \
42+
--resource-group dbatools-ci-runners \
43+
--new-capacity 6
44+
45+
echo "Waiting for instances to provision..."
46+
sleep 60
47+
48+
- name: Wait for runners to register
49+
timeout-minutes: 10
50+
run: |
51+
echo "Waiting for self-hosted runners to become available..."
52+
for i in {1..60}; do
53+
runner_count=$(gh api repos/dataplat/dbatools/actions/runners --jq '[.runners[] | select(.status == "online" and .busy == false)] | length')
54+
echo "Available runners: $runner_count"
55+
if [ "$runner_count" -ge 6 ]; then
56+
echo "All 6 runners are online and ready!"
57+
break
58+
fi
59+
sleep 10
60+
done
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
64+
vmss-sql-tests:
65+
name: SQL Server Tests on VMSS
66+
needs: azure-vmss-tests
67+
runs-on: [self-hosted, Windows]
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
test_group: [1, 2, 3, 4, 5, 6]
72+
steps:
73+
- name: Checkout dbatools repo
74+
uses: actions/checkout@v3
75+
76+
- name: Run SQL Server tests
77+
shell: pwsh
78+
run: |
79+
Import-Module ./dbatools.psd1 -Force
80+
Write-Host "Running test group ${{ matrix.test_group }} on $(hostname)"
81+
# Your actual test commands here
82+
83+
cleanup-vmss:
84+
name: Scale down VMSS
85+
needs: vmss-sql-tests
86+
if: always()
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Azure Login
90+
uses: azure/login@v1
91+
with:
92+
creds: ${{ secrets.AZURE_CREDENTIALS }}
93+
94+
- name: Scale VMSS back to 0
95+
run: |
96+
echo "Scaling VMSS back to 0 instances..."
97+
az vmss scale \
98+
--name dbatools-runner-vmss \
99+
--resource-group dbatools-ci-runners \
100+
--new-capacity 0
101+
28102
linux-tests:
29103
env:
30104
SMODefaultModuleName: dbatools

0 commit comments

Comments
 (0)