Skip to content

Improve certificate backup test assertions #1193

Improve certificate backup test assertions

Improve certificate backup test assertions #1193

name: Run Replication Tests
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.json'
- 'docs/**'
- '.github/FUNDING.yml'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE.md'
- '.aider/**'
- '.devcontainer/**'
- '.vscode/**'
- 'bin/**'
- 'en-us/**'
defaults:
run:
shell: pwsh
jobs:
repl-tests-part1:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v3
- name: Read dbatools.library version
id: get-version
shell: pwsh
run: |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json
$version = $versionConfig.version
$isPreview = $version -like "*preview*"
Write-Output "version=$version" >> $env:GITHUB_OUTPUT
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT
Write-Output "Using dbatools.library version: $version"
Write-Output "Is preview version: $isPreview"
- name: Install and cache PowerShell modules (stable versions)
if: steps.get-version.outputs.is_preview == 'False'
uses: potatoqualitee/[email protected]
with:
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }}
- name: Install dbatools.library (preview versions)
if: steps.get-version.outputs.is_preview == 'True'
shell: pwsh
run: |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script"
./.github/scripts/install-dbatools-library.ps1
- name: Set encryption values
run: |
Import-Module ./dbatools.psd1 -Force
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning
- name: Setup docker images
run: |
# create a shared network
docker network create localnet
# Expose engine and endpoint then setup a shared path for migrations
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance
# Expose second engine and endpoint on different port
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2
- name: Add hostname to hosts file
run: |
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts
- name: 👥 Clone appveyor repo
working-directory: /tmp
run: |
gh repo clone dataplat/appveyor-lab
- name: Setup Replication
run: |
Import-Module ./dbatools.psd1 -Force
# need some folders for our repl stuff
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData
- name: Run replication tests part 1
run: |
Import-Module ./dbatools.psd1 -Force
# Disabled for now, it's suddenly failing
# $null = Invoke-Pester .github/scripts/gh-actions-repl-1.ps1 -Output Detailed -PassThru -Verbose
repl-tests-part2:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v3
- name: Read dbatools.library version
id: get-version
shell: pwsh
run: |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json
$version = $versionConfig.version
$isPreview = $version -like "*preview*"
Write-Output "version=$version" >> $env:GITHUB_OUTPUT
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT
Write-Output "Using dbatools.library version: $version"
Write-Output "Is preview version: $isPreview"
- name: Install and cache PowerShell modules (stable versions)
if: steps.get-version.outputs.is_preview == 'False'
uses: potatoqualitee/[email protected]
with:
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }}
- name: Install dbatools.library (preview versions)
if: steps.get-version.outputs.is_preview == 'True'
shell: pwsh
run: |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script"
./.github/scripts/install-dbatools-library.ps1
- name: Set encryption values
run: |
Import-Module ./dbatools.psd1 -Force
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning
- name: Setup docker images
run: |
# create a shared network
docker network create localnet
# Expose engine and endpoint then setup a shared path for migrations
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance
# Expose second engine and endpoint on different port
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2
- name: Add hostname to hosts file
run: |
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts
- name: 👥 Clone appveyor repo
working-directory: /tmp
run: |
gh repo clone dataplat/appveyor-lab
- name: Setup Replication
run: |
Import-Module ./dbatools.psd1 -Force
# need some folders for our repl stuff
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData
- name: Run replication tests part 2
if: env.TESTS_FIXED == 'true'
run: |
Import-Module ./dbatools.psd1 -Force
$null = Invoke-Pester .github/scripts/gh-actions-repl-2.ps1 -Output Detailed -PassThru -Verbose
repl-tests-part3:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v3
- name: Read dbatools.library version
id: get-version
shell: pwsh
run: |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json
$version = $versionConfig.version
$isPreview = $version -like "*preview*"
Write-Output "version=$version" >> $env:GITHUB_OUTPUT
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT
Write-Output "Using dbatools.library version: $version"
Write-Output "Is preview version: $isPreview"
- name: Install and cache PowerShell modules (stable versions)
if: steps.get-version.outputs.is_preview == 'False'
uses: potatoqualitee/[email protected]
with:
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }}
- name: Install dbatools.library (preview versions)
if: steps.get-version.outputs.is_preview == 'True'
shell: pwsh
run: |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script"
./.github/scripts/install-dbatools-library.ps1
- name: Set encryption values
run: |
Import-Module ./dbatools.psd1 -Force
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning
- name: Setup docker images
run: |
# create a shared network
docker network create localnet
# Expose engine and endpoint then setup a shared path for migrations
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance
# Expose second engine and endpoint on different port
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2
- name: Add hostname to hosts file
run: |
echo "127.0.0.1 mssql1 mssql2" | sudo tee -a /etc/hosts
- name: 👥 Clone appveyor repo
working-directory: /tmp
run: |
gh repo clone dataplat/appveyor-lab
- name: Setup Replication
run: |
Import-Module ./dbatools.psd1 -Force
# need some folders for our repl stuff
docker exec mssql1 mkdir /shared/data /shared/repldata /var/opt/mssql/ReplData
- name: Run replication tests part 3
run: |
Import-Module ./dbatools.psd1 -Force
# Invoke-Pester .github/scripts/gh-actions-repl-3.ps1 -Output Detailed -PassThru -Verbose