Add AsyncMigrationBase, update base classes and call async methods (#17057)
* Add AsyncMigrationBase, update base classes and call async methods * Restored and obsoleted synchronous execution on IMigrationPlanExecutor. * Resolved breaking changes. * Fixed build. * Further obsoletes. * Fix build against v16/dev. * Removed and obsolete code related to post-migrations. * Removed service registration of unused interface. --------- Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
@@ -47,10 +47,11 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
DatabaseCacheRebuilder,
|
||||
DistributedCache,
|
||||
Mock.Of<IKeyValueService>(),
|
||||
ServiceScopeFactory);
|
||||
ServiceScopeFactory,
|
||||
AppCaches.NoCache);
|
||||
|
||||
[Test]
|
||||
public void CreateTableOfTDto()
|
||||
public async Task CreateTableOfTDtoAsync()
|
||||
{
|
||||
var builder = Mock.Of<IMigrationBuilder>();
|
||||
Mock.Get(builder)
|
||||
@@ -72,7 +73,7 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
.From(string.Empty)
|
||||
.To<CreateTableOfTDtoMigration>("done"));
|
||||
|
||||
upgrader.Execute(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>());
|
||||
await upgrader.ExecuteAsync(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>()).ConfigureAwait(false);
|
||||
|
||||
var db = ScopeAccessor.AmbientScope.Database;
|
||||
var exists = ScopeAccessor.AmbientScope.SqlContext.SqlSyntax.DoesTableExist(db, "umbracoUser");
|
||||
@@ -82,7 +83,7 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteKeysAndIndexesOfTDto()
|
||||
public async Task DeleteKeysAndIndexesOfTDtoAsync()
|
||||
{
|
||||
var builder = Mock.Of<IMigrationBuilder>();
|
||||
Mock.Get(builder)
|
||||
@@ -108,13 +109,13 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
.To<CreateTableOfTDtoMigration>("a")
|
||||
.To<DeleteKeysAndIndexesMigration>("done"));
|
||||
|
||||
upgrader.Execute(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>());
|
||||
await upgrader.ExecuteAsync(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>()).ConfigureAwait(false);
|
||||
scope.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateKeysAndIndexesOfTDto()
|
||||
public async Task CreateKeysAndIndexesOfTDtoAsync()
|
||||
{
|
||||
if (BaseTestDatabase.IsSqlite())
|
||||
{
|
||||
@@ -150,13 +151,13 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
.To<DeleteKeysAndIndexesMigration>("b")
|
||||
.To<CreateKeysAndIndexesOfTDtoMigration>("done"));
|
||||
|
||||
upgrader.Execute(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>());
|
||||
await upgrader.ExecuteAsync(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>()).ConfigureAwait(false);
|
||||
scope.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateKeysAndIndexes()
|
||||
public async Task CreateKeysAndIndexesAsync()
|
||||
{
|
||||
if (BaseTestDatabase.IsSqlite())
|
||||
{
|
||||
@@ -192,13 +193,13 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
.To<DeleteKeysAndIndexesMigration>("b")
|
||||
.To<CreateKeysAndIndexesMigration>("done"));
|
||||
|
||||
upgrader.Execute(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>());
|
||||
await upgrader.ExecuteAsync(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>()).ConfigureAwait(false);
|
||||
scope.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddColumn()
|
||||
public async Task AddColumnAsync()
|
||||
{
|
||||
var builder = Mock.Of<IMigrationBuilder>();
|
||||
Mock.Get(builder)
|
||||
@@ -224,7 +225,7 @@ public class AdvancedMigrationTests : UmbracoIntegrationTest
|
||||
.To<CreateTableOfTDtoMigration>("a")
|
||||
.To<AddColumnMigration>("done"));
|
||||
|
||||
upgrader.Execute(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>());
|
||||
await upgrader.ExecuteAsync(MigrationPlanExecutor, ScopeProvider, Mock.Of<IKeyValueService>()).ConfigureAwait(false);
|
||||
|
||||
var db = ScopeAccessor.AmbientScope.Database;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user