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

Errors when database is not present/incorrect. #5613

Merged
merged 3 commits into from
May 27, 2019

Conversation

shaneis
Copy link
Contributor

@shaneis shaneis commented May 27, 2019

Type of Change

  • Bug fix (non-breaking change, fixes #)
  • New feature (non-breaking change, adds functionality)
  • Breaking change (effects multiple commands or functionality)
  • 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/sqlcollaborative/appveyor-lab ?
  • Nunit test is included
  • Documentation
  • Build system

Purpose

If a database that is not present/incorrect is passed into New-DbaDbUser, the function should error out.
This is different from the silently returning that it was originally doing.

Attempted to add a Pester Unit test for this but it would not throw. Added a -Skip to the test until I can figure out what is causing it issues.

Approach

Code now has a if ($null -eq $databases -or $databases.Count -eq 0) { Stop-Function... } block to error out.

Commands to test

New-DbaDbUser -SqlInstance < instance name > -database 'FakeyMcFakeFake' -User 'ItDoesn'tMatter'

Screenshots

Learning

@potatoqualitee
Copy link
Member

awww yeahhhh! thank you 🙇

@potatoqualitee potatoqualitee merged commit a75e1c6 into dataplat:prerelease May 27, 2019
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.

2 participants