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

Get-DbaDbCompression: Add DatabaseId to the return object #8769

Conversation

lancasteradam
Copy link
Contributor

Please read -- recent changes to our repo

On November 10, 2022, we removed some bloat from our repository (for the second and final time). This change requires that all contributors reclone or refork their repo.

PRs from repos that have not been recently reforked or recloned will be closed and @potatoqualitee will cherry-pick your commits and open a new PR with your changes.

  • Please confirm you have the smaller repo (85MB .git directory vs 275MB or 110MB or 185MB .git directory)

Type of Change

  • Bug fix (non-breaking change, fixes # )
  • New feature (non-breaking change, adds functionality, related to Add DatabaseID to the return object for relevant commands #8183 )
  • Breaking change (effects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (.\tests\manual.pester.ps1)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Purpose

Minor change to add DatabaseId to the return object.

Commands to test

See current Pester tests for this command.

$server = Connect-DbaInstance -SqlInstance $script:instance2
$null = $server.Query("Create Database [$dbname]")
$db = New-DbaDatabase -SqlInstance $script:instance2 -Database $dbname
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this line, no reason to include another module command in this test. Issuing the T-SQL command is much simpler.

$null = $server.Query("select * into syscols from sys.all_columns
select * into sysallparams from sys.all_parameters
create clustered index CL_sysallparams on sysallparams (object_id)
create nonclustered index NC_syscols on syscols (precision) include (collation_name)", $dbname)
}
AfterAll {
Get-DbaProcess -SqlInstance $script:instance2 -Database $dbname | Stop-DbaProcess -WarningAction SilentlyContinue
Remove-DbaDatabase -SqlInstance $script:instance2 -Database $dbname -Confirm:$false
$db | Remove-DbaDatabase -Confirm:$false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert.

@@ -32,8 +32,10 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
Context "Command handles heaps and clustered indexes" {
It "Gets results" {
$results | Should Not Be $null
$results.Database | Get-Unique | Should -Be $dbname
$results.DatabaseId | Get-Unique | Should -Be $server.Query("SELECT database_id FROM sys.databases WHERE name = '$dbname'").database_id
Copy link
Member

@wsmelton wsmelton Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Believe this only works because we are still on Pester v4 in v5 it won't execute script commands found in the It block and would always fail. Do not have to change now because this test alone will have to be reworked anyway if we ever get around to converting to v5.

@potatoqualitee
Copy link
Member

Thank you both 🙇🏼

@potatoqualitee potatoqualitee merged commit 1b1ca7b into dataplat:development Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants