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

Additional testing for sql database continuous copy scenarios #9281

Merged
merged 1 commit into from
Jan 2, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,84 @@ public void TestCopyDatabase()
SqlManagementTestUtilities.ValidateDatabase(db, dbCopy, dbCopy.Name);
}
}

[Fact]
public void TestContinuousCopyDatabase()
{
using (SqlManagementTestContext context = new SqlManagementTestContext(this))
{
ResourceGroup resourceGroup = context.CreateResourceGroup();
SqlManagementClient sqlClient = context.GetClient<SqlManagementClient>();

//Create two servers
var server = context.CreateServer(resourceGroup);
var server2 = context.CreateServer(resourceGroup);

// Create a database with all parameters specified
//
string dbName = SqlManagementTestUtilities.GenerateName();
var dbInput = new Database()
{
Location = server.Location,
Collation = SqlTestConstants.DefaultCollation,
Sku = new Microsoft.Azure.Management.Sql.Models.Sku(ServiceObjectiveName.S3),
CreateMode = "Default"
};
var db = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, dbInput);
Assert.NotNull(db);

// Create a secondary database
//
dbName = SqlManagementTestUtilities.GenerateName();
var dbInputSecondary = new Database()
{
Location = server2.Location,
CreateMode = CreateMode.Secondary,
Sku = new Microsoft.Azure.Management.Sql.Models.Sku(ServiceObjectiveName.S3),
SourceDatabaseId = db.Id
};
var dbSecondary = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server2.Name, dbName, dbInputSecondary);
Assert.NotNull(dbSecondary);
}
}

[Fact]
public void TestContinuousCopyHyperscaleDatabase()
{
using (SqlManagementTestContext context = new SqlManagementTestContext(this))
{
ResourceGroup resourceGroup = context.CreateResourceGroup();
SqlManagementClient sqlClient = context.GetClient<SqlManagementClient>();

//Create two servers
var server = context.CreateServer(resourceGroup);
var server2 = context.CreateServer(resourceGroup);

// Create a database with all parameters specified
//
string dbName = SqlManagementTestUtilities.GenerateName();
var dbInput = new Database()
{
Location = server.Location,
Collation = SqlTestConstants.DefaultCollation,
Sku = new Microsoft.Azure.Management.Sql.Models.Sku("SQLDB_HS_Gen5_2"),
CreateMode = "Default"
};
var db = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server.Name, dbName, dbInput);
Assert.NotNull(db);

// Create a secondary database
//
var dbInputSecondary = new Database()
{
Location = server2.Location,
CreateMode = CreateMode.Secondary,
Sku = new Microsoft.Azure.Management.Sql.Models.Sku("SQLDB_HS_Gen5_2"),
SourceDatabaseId = db.Id
};
var dbSecondary = sqlClient.Databases.CreateOrUpdate(resourceGroup.Name, server2.Name, dbName + "_secondary", dbInputSecondary);
Assert.NotNull(dbSecondary);
}
}
}
}
Loading