Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tests and bug fixes #7558

Merged
merged 5 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions functions/Install-DbaDarlingData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ function Install-DbaDarlingData {
$null = New-Item -Path $LocalCachedCopy -ItemType Container
}
if ($Procedure -eq 'All' -or $Procedure -contains 'Human') {
Copy-Item -Path "$zipFolder\sp_humanevents\sp_humanevents.sql" -Destination $LocalCachedCopy
Copy-Item -Path "$zipFolder\sp_HumanEvents\sp_HumanEvents.sql" -Destination $LocalCachedCopy
}
if ($procedure -eq 'All' -or $Procedure -contains 'Pressure') {
Copy-Item -Path "$zipFolder\sp_pressuredetector\sp_pressuredetector.sql" -Destination $LocalCachedCopy
Copy-Item -Path "$zipFolder\sp_PressureDetector\sp_PressureDetector.sql" -Destination $LocalCachedCopy
}
if ($Procedure -eq 'All' -or $Procedure -contains 'Quickie') {
Copy-Item -Path "$zipFolder\sp_quickiestore\sp_quickiestore.sql" -Destination $LocalCachedCopy
Copy-Item -Path "$zipFolder\sp_QuickieStore\sp_QuickieStore.sql" -Destination $LocalCachedCopy
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion functions/Test-DbaManagementObject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Test-DbaManagementObject {
try {
Invoke-Command2 -ComputerName $computer -ScriptBlock $scriptBlock -Credential $Credential -ArgumentList $VersionNumber -ErrorAction Stop
} catch {
Stop-Function -Continue -Message "Failure" -ErrorRecord $_ -Target $computer -Continue
Stop-Function -Continue -Message "Failure" -ErrorRecord $_ -Target $computer
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/functions/Join-AdminUnc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ function Join-AdminUnc {

)

if (!$filepath) { return }
if (!$filepath -or $IsLinux -or $IsMacOs) { return }
if ($filepath.StartsWith("\\")) { return $filepath }

$servername = $servername.Split("\")[0]

if ($filepath.length -gt 0 -and $filepath -ne [System.DbNull]::Value -and -not $IsLinux) {
if ($filepath.length -gt 0 -and $filepath -ne [System.DbNull]::Value) {
$newpath = Join-Path "\\$servername\" $filepath.replace(':', '$')
return $newpath
} else { return }
Expand Down
48 changes: 34 additions & 14 deletions tests/gh-actions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Describe "Integration Tests" -Tag "IntegrationTests" {
It "sets up a mirror" {
$newdb = New-DbaDatabase
$params = @{
Database = $newdb.Name
Force = $true
Database = $newdb.Name
Force = $true
}

Invoke-DbaDbMirroring @params | Select-Object -ExpandProperty Status | Should -Be "Success"
Expand Down Expand Up @@ -139,36 +139,56 @@ Describe "Integration Tests" -Tag "IntegrationTests" {

$null = Get-DbaTrace -Id $traceid | ConvertTo-DbaXESession -Name "dbatoolsci-session"
$results = Start-DbaXESession -Session "dbatoolsci-session"
$results.Name | Should -Be "dbatoolsci-session"
$results.Name | Should -Be "dbatoolsci-session"
$results.Status | Should -Be "Running"
$results.Targets.Name | Should -Be "package0.event_file"
}

It "installs darling data" {
$results = Install-DbaDarlingData
$results.Database | Select-Object -First 1 | Should -Be "master"
}

It "tests the instance name" {
$results = Test-DbaInstanceName
$results.RenameRequired | Should -Be $true
}

It "creates a new database user" {
$results = New-DbaDbUser -Database msdb -Username sqladmin -IncludeSystem
$results.Name | Should -Be sqladmin
}

It "returns some permission" {
Get-DbaPermission -Database tempdb | Should -Not -Be $null
}

It "returns the master key" {
(Get-DbaDbMasterKey).Database | Should -Be "master"
}

It "stops an xe session" {
(Stop-DbaXESession -Session "dbatoolsci-session").Name | Should -Be "dbatoolsci-session"
}

It "tests tempdb configs" {
(Test-DbaTempDbConfig).Rule | Should -Contain "File Growth in Percent"
}
}


<#
# fails on newer version of SMO
'Get-DbaUserPermission',
'Invoke-DbaBalanceDataFiles',
'Invoke-DbaWhoisActive',
'Install-DbaDarlingData',
'Remove-DbaAvailabilityGroup',
'Set-DbaAgReplica',
'Read-DbaAuditFile',
'Sync-DbaLoginPermission',
'Read-DbaXEFile',
'Stop-DbaXESession',
'Test-DbaTempDbConfig',
'New-DbaDbUser',
'Stop-DbaXESession',
'New-DbaLogin',
'Watch-DbaDbLogin',
'ConvertTo-DbaXESession',
'Test-DbaInstanceName',
'Test-DbaDeprecatedFeature',
'Remove-DbaDatabaseSafely',
'Get-DbaDbMasterKey',
'Get-DbaPermission',
'Test-DbaManagementObject',
'Export-DbaDacPackage'
#>