Skip to content

Commit

Permalink
Remove quirk tests due to global race condition
Browse files Browse the repository at this point in the history
Fixes #13262

Since two test suites both switch the quirk on and off, but the quirk is global, it results in a race condition where one test is expecting it to be off, but it then gets switched off while that test is running. Fix is to remove these tests since they have little value going forward.
  • Loading branch information
ajcvickers committed Sep 11, 2018
1 parent ce59403 commit 7b11733
Showing 1 changed file with 0 additions and 105 deletions.
105 changes: 0 additions & 105 deletions test/EFCore.InMemory.FunctionalTests/UpdatesInMemoryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

using System;
using System.Threading.Tasks;
#if Test20
using Microsoft.EntityFrameworkCore.Internal;
#else
using Microsoft.EntityFrameworkCore.InMemory.Internal;
#endif
using Microsoft.EntityFrameworkCore.TestModels.UpdatesModel;
using Xunit;

namespace Microsoft.EntityFrameworkCore
{
Expand All @@ -21,106 +16,6 @@ protected UpdatesInMemoryTestBase(TFixture fixture)
{
}

#if !Test20
[Fact]
public virtual void Update_on_bytes_concurrency_token_original_value_matches_throws_with_quirk()
{
var productId = Guid.NewGuid();

try
{
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", true);

ExecuteWithStrategyInTransaction(
context =>
{
context.Add(
new ProductWithBytes
{
Id = productId,
Name = "MegaChips",
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
});
context.SaveChanges();
},
context =>
{
var entry = context.ProductWithBytes.Attach(
new ProductWithBytes
{
Id = productId,
Name = "MegaChips",
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
});
entry.Entity.Name = "GigaChips";
Assert.Throws<DbUpdateConcurrencyException>(
() => context.SaveChanges());
},
context =>
{
Assert.Equal("MegaChips", context.ProductWithBytes.Find(productId).Name);
});

}
finally
{
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", false);
}
}

[Fact]
public virtual void Remove_on_bytes_concurrency_token_original_value_matches_throws_with_quirk()
{
var productId = Guid.NewGuid();

try
{
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", true);

ExecuteWithStrategyInTransaction(
context =>
{
context.Add(
new ProductWithBytes
{
Id = productId,
Name = "MegaChips",
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
});
context.SaveChanges();
},
context =>
{
var entry = context.ProductWithBytes.Attach(
new ProductWithBytes
{
Id = productId,
Name = "MegaChips",
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
});
entry.State = EntityState.Deleted;
Assert.Throws<DbUpdateConcurrencyException>(
() => context.SaveChanges());
},
context =>
{
Assert.Equal("MegaChips", context.ProductWithBytes.Find(productId).Name);
});

}
finally
{
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", false);
}
}
#endif

protected override string UpdateConcurrencyMessage
=> InMemoryStrings.UpdateConcurrencyException;

Expand Down

0 comments on commit 7b11733

Please sign in to comment.