Skip to content

Conversation

@bradrich-msft
Copy link
Contributor

Description

New-AzSqlDatabaseSecondary cmdlet was returning the wrong database name in existing database error in some cases.
This fixes that by using the correct method to get database name. This was missed in earlier change.

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

@adxsdkps
Copy link
Collaborator

Can one of the admins verify this patch?

@wyunchi-ms
Copy link
Contributor

Hi @bradrich-msft , Is there any issue for this PR?

@bradrich-msft
Copy link
Contributor Author

Hi @bradrich-msft , Is there any issue for this PR?

No.

@bradrich-msft
Copy link
Contributor Author

Hi @wyunchi-ms
I see you have marked this PR with "needs-revision" but I can find no other comments or indications as to why. Can you please clarify? Thank you.

// The database already exists
throw new PSArgumentException(
string.Format(Resources.DatabaseNameExists, this.DatabaseName, this.PartnerServerName),
string.Format(Resources.DatabaseNameExists, GetEffectivePartnerDatabaseName(this.DatabaseName, this.PartnerDatabaseName), this.PartnerServerName),
Copy link

@Anvesha4 Anvesha4 Jul 18, 2020

Choose a reason for hiding this comment

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

Thanks for fixing this!
This will tell the user that "Database already exists" for the secondary (partner) database without mentioning that is failing because of the partner database. I wonder how much work it is to add a new error message (something like "PartnerDatabaseNameExists" instead of using the existing DatabaseNameExists

.SYNOPSIS
Tests creating a named secondary database of already existing database
#>
function Test-CreateNamedSecondaryDatabaseNegative()
Copy link

@Anvesha4 Anvesha4 Jul 18, 2020

Choose a reason for hiding this comment

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

Is this the only negative test? In case we add more negative tests, can we be more specific like TestNegative-CreateNamedSecondaryAlreadyExists or something similar to indicate the test scenario?

@wyunchi-ms wyunchi-ms merged commit 385cf2e into Azure:master Jul 19, 2020
@wyunchi-ms
Copy link
Contributor

Hi @wyunchi-ms
I see you have marked this PR with "needs-revision" but I can find no other comments or indications as to why. Can you please clarify? Thank you.

I was wondering whether there is a issue for this. It's OK now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants