Skip to content

Commit

Permalink
Fix build break
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Jul 28, 2024
1 parent 3d6868e commit 5aa72df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,11 @@ public void Non_transactional_migration_is_retried()
{
using var context = new BloggingContext(
Fixture.TestStore.AddProviderOptions(
new DbContextOptionsBuilder().EnableServiceProviderCaching(false))
.ConfigureWarnings(e => e.Log(RelationalEventId.PendingModelChangesWarning))
.UseLoggerFactory(Fixture.TestSqlLoggerFactory).Options);
new DbContextOptionsBuilder().EnableServiceProviderCaching(false))
.ConfigureWarnings(
e => e.Log(
RelationalEventId.PendingModelChangesWarning, RelationalEventId.NonTransactionalMigrationOperationWarning))
.UseLoggerFactory(Fixture.TestSqlLoggerFactory).Options);

context.Database.EnsureDeleted();
GiveMeSomeTime(context);
Expand Down Expand Up @@ -1078,9 +1080,11 @@ public async Task Non_transactional_migration_is_retried_async()
{
using var context = new BloggingContext(
Fixture.TestStore.AddProviderOptions(
new DbContextOptionsBuilder().EnableServiceProviderCaching(false))
.ConfigureWarnings(e => e.Log(RelationalEventId.PendingModelChangesWarning))
.UseLoggerFactory(Fixture.TestSqlLoggerFactory).Options);
new DbContextOptionsBuilder().EnableServiceProviderCaching(false))
.ConfigureWarnings(
e => e.Log(
RelationalEventId.PendingModelChangesWarning, RelationalEventId.NonTransactionalMigrationOperationWarning))
.UseLoggerFactory(Fixture.TestSqlLoggerFactory).Options);

context.Database.EnsureDeleted();
GiveMeSomeTime(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,13 @@ public async Task Throws_if_database_does_not_exist(bool async)
using var testDatabase = SqlServerTestStore.GetOrCreate("NonExisting");
var creator = GetDatabaseCreator(testDatabase);

var errorNumber
= async
? (await Assert.ThrowsAsync<SqlException>(() => creator.CreateTablesAsync())).Number
: Assert.Throws<SqlException>(() => creator.CreateTables()).Number;
var exception = async
? (await Assert.ThrowsAsync<RetryLimitExceededException>(() => creator.CreateTablesAsync()))
: Assert.Throws<RetryLimitExceededException>(() => creator.CreateTables());

Assert.Equal(CoreStrings.RetryLimitExceeded(6, "TestSqlServerRetryingExecutionStrategy"), exception.Message);

var errorNumber = ((SqlException)exception.InnerException!).Number;

if (errorNumber != 233) // skip if no-process transient failure
{
Expand Down

0 comments on commit 5aa72df

Please sign in to comment.