Skip to content

Commit 172b856

Browse files
authored
Merge pull request #7831 from haitsongmsft/preview
Add MongoDb migration support to DataMigration service
2 parents 75daf85 + 46b1f02 commit 172b856

File tree

54 files changed

+14936
-2214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+14936
-2214
lines changed

src/ResourceManager/DataMigration/Commands.DataMigration.Test/Commands.DataMigration.Test.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</PropertyGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="Microsoft.Azure.Management.DataMigration" Version="0.5.0-preview" />
27+
<PackageReference Include="Microsoft.Azure.Management.DataMigration" Version="0.6.0-preview" />
2828
</ItemGroup>
2929

3030
<ItemGroup>

src/ResourceManager/DataMigration/Commands.DataMigration.Test/ScenarioTests/Common.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,31 @@ function Create-Project($rg, $service, $targetPlatform)
108108
return $project
109109
}
110110

111+
function Create-ProjectMongoDbMongoDb($rg, $service)
112+
{
113+
$ProjectName = Get-ProjectName
114+
$sourceConnInfo = New-SourceMongoDbConnectionInfo
115+
$targetConnInfo = New-TargetMongoDbConnectionInfo
116+
117+
$project = New-AzureRmDataMigrationProject -ResourceGroupName $rg.ResourceGroupName -ServiceName $service.Name -ProjectName $ProjectName -Location $rg.Location -SourceType MongoDb -TargetType MongoDb -SourceConnection $sourceConnInfo -TargetConnection $targetConnInfo
118+
119+
return $project
120+
}
121+
122+
function New-SourceMongoDbConnectionInfo
123+
{
124+
$sourceConn = [Microsoft.Azure.Commands.DataMigrationConfig]::GetConfigString("MONGODB_SOURCE_CONNECTIONSTRING")
125+
$connectioninfo = New-AzureRmDmsConnInfo -ServerType MongoDb -ConnectionString $sourceConn
126+
return $connectioninfo
127+
}
128+
129+
function New-TargetMongoDbConnectionInfo
130+
{
131+
$cosmosConn = [Microsoft.Azure.Commands.DataMigrationConfig]::GetConfigString("COSMOSDB_TARGET_CONNECTIONSTRING")
132+
$connectioninfo = New-AzureRmDmsConnInfo -ServerType MongoDb -ConnectionString $cosmosConn
133+
return $connectioninfo
134+
}
135+
111136
function getDmsAssetName($prefix)
112137
{
113138
$assetName = [Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::GetAssetName("testName",$prefix+"-PsTestRun")

src/ResourceManager/DataMigration/Commands.DataMigration.Test/ScenarioTests/ServiceTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,27 @@ public void TestMigrateSqlSqlDBSync()
147147
{
148148
DataMigrationTestController.NewInstance.RunPsTest(_logger, "Test-MigrateSqlSqlDBSync");
149149
}
150+
151+
[Fact]
152+
[Trait(Category.AcceptanceType, Category.CheckIn)]
153+
public void TestConnectToSourceMongoDb()
154+
{
155+
DataMigrationTestController.NewInstance.RunPsTest(_logger, "Test-ConnectToSourceMongoDb");
156+
}
157+
158+
159+
[Fact]
160+
[Trait(Category.AcceptanceType, Category.CheckIn)]
161+
public void TestConnectToTargetCosmosDb()
162+
{
163+
DataMigrationTestController.NewInstance.RunPsTest(_logger, "Test-ConnectToTargetCosmosDb");
164+
}
165+
166+
[Fact]
167+
[Trait(Category.AcceptanceType, Category.CheckIn)]
168+
public void TestMigrateMongoDb()
169+
{
170+
DataMigrationTestController.NewInstance.RunPsTest(_logger, "Test-MigrateMongoDb");
171+
}
150172
}
151173
}

src/ResourceManager/DataMigration/Commands.DataMigration.Test/ScenarioTests/ServiceTests.ps1

Lines changed: 184 additions & 82 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)