-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add failover group operations #3155
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
Conversation
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
|
@btasdoven, |
| cancellationToken.ThrowIfCancellationRequested(); | ||
| string _responseContent = null; | ||
| if ((int)_statusCode != 201 && (int)_statusCode != 202) | ||
| if ((int)_statusCode != 200 && (int)_statusCode != 202) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: Swagger change was Azure/azure-rest-api-specs#1166
| { | ||
| ReadOnlyEndpoint = new FailoverGroupReadOnlyEndpoint() | ||
| { | ||
| FailoverPolicy = "Disabled", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to write ReadOnlyEndpointFailoverPolicy.Disabled. (How do I know? see https://github.com/Azure/azure-rest-api-specs/blob/master/arm-sql/2015-05-01-preview/swagger/failoverGroups.json#L490 )
| }, | ||
| ReadWriteEndpoint = new FailoverGroupReadWriteEndpoint() | ||
| { | ||
| FailoverPolicy = "Automatic", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ReadWriteEndpointFailoverPolicy.Automatic
| } | ||
|
|
||
| [Fact] | ||
| public void TestUpdateFailoverGroup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit repetitive, could this be part of the above test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or could you at least factor out the common setup code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined the test cases into one.
| var targetDatabase = sqlClient.Databases.Get(resourceGroup.Name, partnerServer.Name, databaseName); | ||
| Assert.NotNull(sourceDatabase.FailoverGroupId); | ||
| Assert.NotNull(targetDatabase.FailoverGroupId); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you have a test where you call Failover? Seems like an important scenario for FailoverGroups ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have to be a separate test, could be part of this or the other one. As long as it's covered somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense :) Added failover operation as part of the test case.
| { | ||
| public class FailoverGroupCrudScenarioTests | ||
| { | ||
| public static string DefaultPrimaryLocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add these to SqlManagementTestUtilities?
I'm guessing they're for stage, maybe make them DefaultStageLocation and DefaultStageSecondaryLocation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, they are for Stage. Moved them to SqlManagementTestUtilities.
| } | ||
| } | ||
|
|
||
| private Server CreateServer(SqlManagementClient sqlClient, ResourceGroup resourceGroup, string serverPrefix, string location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be useful in SqlManagementTestUtilities as well, could you put it there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
| } | ||
|
|
||
| private Server CreateServer(SqlManagementClient sqlClient, ResourceGroup resourceGroup, string serverPrefix, string location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also move this to SqlManagementTestUtilities?
| // | ||
| var failoverGroupOnSecondary = sqlClient.FailoverGroups.Get(resourceGroup.Name, sourceServer.Name, failoverGroupName); | ||
| Assert.Equal(FailoverGroupReplicationRole.Secondary, failoverGroupOnSecondary.ReplicationRole); | ||
| Assert.Equal(FailoverGroupReplicationRole.Primary, failoverGroupOnSecondary.PartnerServers.First().ReplicationRole); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful. 💯
shahabhijeet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any change in version.
Will need changes to csproj and assemblyinfo files related to versions.
|
@azuresdkci add to whitelist |
|
@shahabhijeet, do you have any other comments? |
Adding Failover Groups operations to Microsoft.Sql provider with their tests, and reflecting the API changes in our swagger file.
This is a breaking change in terms of Failover Groups APIs; however, this should not be an issue since the feature has not gone public.
Description
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
Testing Guidelines
SDK Generation Guidelines
project.jsonandAssemblyInfo.csfiles have been updated with the new version of the SDK.