Skip to content

Commit 7b11733

Browse files
committed
Remove quirk tests due to global race condition
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.
1 parent ce59403 commit 7b11733

File tree

1 file changed

+0
-105
lines changed

1 file changed

+0
-105
lines changed

test/EFCore.InMemory.FunctionalTests/UpdatesInMemoryTestBase.cs

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33

44
using System;
55
using System.Threading.Tasks;
6-
#if Test20
7-
using Microsoft.EntityFrameworkCore.Internal;
8-
#else
96
using Microsoft.EntityFrameworkCore.InMemory.Internal;
10-
#endif
117
using Microsoft.EntityFrameworkCore.TestModels.UpdatesModel;
12-
using Xunit;
138

149
namespace Microsoft.EntityFrameworkCore
1510
{
@@ -21,106 +16,6 @@ protected UpdatesInMemoryTestBase(TFixture fixture)
2116
{
2217
}
2318

24-
#if !Test20
25-
[Fact]
26-
public virtual void Update_on_bytes_concurrency_token_original_value_matches_throws_with_quirk()
27-
{
28-
var productId = Guid.NewGuid();
29-
30-
try
31-
{
32-
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", true);
33-
34-
ExecuteWithStrategyInTransaction(
35-
context =>
36-
{
37-
context.Add(
38-
new ProductWithBytes
39-
{
40-
Id = productId,
41-
Name = "MegaChips",
42-
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
43-
});
44-
45-
context.SaveChanges();
46-
},
47-
context =>
48-
{
49-
var entry = context.ProductWithBytes.Attach(
50-
new ProductWithBytes
51-
{
52-
Id = productId,
53-
Name = "MegaChips",
54-
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
55-
});
56-
57-
entry.Entity.Name = "GigaChips";
58-
59-
Assert.Throws<DbUpdateConcurrencyException>(
60-
() => context.SaveChanges());
61-
},
62-
context =>
63-
{
64-
Assert.Equal("MegaChips", context.ProductWithBytes.Find(productId).Name);
65-
});
66-
67-
}
68-
finally
69-
{
70-
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", false);
71-
}
72-
}
73-
74-
[Fact]
75-
public virtual void Remove_on_bytes_concurrency_token_original_value_matches_throws_with_quirk()
76-
{
77-
var productId = Guid.NewGuid();
78-
79-
try
80-
{
81-
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", true);
82-
83-
ExecuteWithStrategyInTransaction(
84-
context =>
85-
{
86-
context.Add(
87-
new ProductWithBytes
88-
{
89-
Id = productId,
90-
Name = "MegaChips",
91-
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
92-
});
93-
94-
context.SaveChanges();
95-
},
96-
context =>
97-
{
98-
var entry = context.ProductWithBytes.Attach(
99-
new ProductWithBytes
100-
{
101-
Id = productId,
102-
Name = "MegaChips",
103-
Bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }
104-
});
105-
106-
entry.State = EntityState.Deleted;
107-
108-
Assert.Throws<DbUpdateConcurrencyException>(
109-
() => context.SaveChanges());
110-
},
111-
context =>
112-
{
113-
Assert.Equal("MegaChips", context.ProductWithBytes.Find(productId).Name);
114-
});
115-
116-
}
117-
finally
118-
{
119-
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue12214", false);
120-
}
121-
}
122-
#endif
123-
12419
protected override string UpdateConcurrencyMessage
12520
=> InMemoryStrings.UpdateConcurrencyException;
12621

0 commit comments

Comments
 (0)