Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-deterministic test issue in ManyToManyQueryTestBase #21638

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public virtual Task Skip_navigation_long_count_with_predicate(bool async)
{
return AssertQuery(
async,
ss => ss.Set<EntityTwo>().OrderByDescending(e => e.SelfSkipSharedLeft.LongCount(e => e.Name.StartsWith("L"))),
ss => ss.Set<EntityTwo>().OrderByDescending(e => e.SelfSkipSharedLeft.LongCount(e => e.Name.StartsWith("L"))).ThenBy(e => e.Id),
assertOrder: true,
entryCount: 20);
}
Expand Down Expand Up @@ -249,7 +249,7 @@ public virtual Task Join_with_skip_navigation(bool async)
async,
ss => from t in ss.Set<EntityTwo>()
join s in ss.Set<EntityTwo>()
on t.Id equals s.SelfSkipSharedRight.FirstOrDefault().Id
on t.Id equals s.SelfSkipSharedRight.OrderBy(e => e.Id).FirstOrDefault().Id
select new { t, s },
elementSorter: e => (e.t.Id, e.s.Id),
elementAsserter: (e, a) =>
Expand All @@ -268,13 +268,13 @@ public virtual Task Left_join_with_skip_navigation(bool async)
async,
ss => from t in ss.Set<EntityCompositeKey>()
join s in ss.Set<EntityCompositeKey>()
on t.TwoSkipShared.FirstOrDefault().Id equals s.ThreeSkipFull.FirstOrDefault().Id into grouping
on t.TwoSkipShared.OrderBy(e => e.Id).FirstOrDefault().Id equals s.ThreeSkipFull.OrderBy(e => e.Id).FirstOrDefault().Id into grouping
from s in grouping.DefaultIfEmpty()
orderby t.Key1, s.Key1
select new { t, s },
ss => from t in ss.Set<EntityCompositeKey>()
join s in ss.Set<EntityCompositeKey>()
on t.TwoSkipShared.FirstOrDefault().MaybeScalar(e => e.Id) equals s.ThreeSkipFull.FirstOrDefault().MaybeScalar(e => e.Id) into grouping
on t.TwoSkipShared.OrderBy(e => e.Id).FirstOrDefault().MaybeScalar(e => e.Id) equals s.ThreeSkipFull.OrderBy(e => e.Id).FirstOrDefault().MaybeScalar(e => e.Id) into grouping
from s in grouping.DefaultIfEmpty()
orderby t.MaybeScalar(e => e.Key1), s.MaybeScalar(e => e.Key1)
select new { t, s },
Expand Down Expand Up @@ -417,7 +417,7 @@ public virtual Task Select_skip_navigation_first_or_default(bool async)
async,
ss => from r in ss.Set<EntityThree>()
orderby r.Id
select r.CompositeKeySkipFull.FirstOrDefault(),
select r.CompositeKeySkipFull.OrderBy(e => e.Key1).FirstOrDefault(),
assertOrder: true,
entryCount: 12);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ ORDER BY (
SELECT COUNT_BIG(*)
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e0] ON [j].[LeftId] = [e0].[Id]
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC");
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC, [e].[Id]");
}

public override async Task Skip_navigation_select_many_average(bool async)
Expand Down Expand Up @@ -364,7 +364,8 @@ FROM [EntityTwos] AS [e]
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[RightId] = [e1].[Id]
WHERE [e0].[Id] = [j].[LeftId])");
WHERE [e0].[Id] = [j].[LeftId]
ORDER BY [e1].[Id])");
}

public override async Task Left_join_with_skip_navigation(bool async)
Expand All @@ -378,11 +379,13 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON (
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoToCompositeKeyShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[TwoId] = [e1].[Id]
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])) = (
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])
ORDER BY [e1].[Id]) = (
SELECT TOP(1) [e2].[Id]
FROM [JoinThreeToCompositeKeyFull] AS [j0]
INNER JOIN [EntityThrees] AS [e2] ON [j0].[ThreeId] = [e2].[Id]
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3]))
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3])
ORDER BY [e2].[Id])
ORDER BY [e].[Key1], [e0].[Key1]");
}

Expand Down Expand Up @@ -551,7 +554,7 @@ FROM [EntityThrees] AS [e]
LEFT JOIN (
SELECT [t].[Key1], [t].[Key2], [t].[Key3], [t].[Name], [t].[ThreeId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3]
FROM (
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3]) AS [row]
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1]) AS [row]
FROM [JoinThreeToCompositeKeyFull] AS [j]
INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3])
) AS [t]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ ORDER BY (
SELECT COUNT_BIG(*)
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e0] ON [j].[LeftId] = [e0].[Id]
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC");
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC, [e].[Id]");
}

public override async Task Skip_navigation_select_many_average(bool async)
Expand Down Expand Up @@ -364,7 +364,8 @@ FROM [EntityTwos] AS [e]
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[RightId] = [e1].[Id]
WHERE [e0].[Id] = [j].[LeftId])");
WHERE [e0].[Id] = [j].[LeftId]
ORDER BY [e1].[Id])");
}

public override async Task Left_join_with_skip_navigation(bool async)
Expand All @@ -378,11 +379,13 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON (
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoToCompositeKeyShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[TwoId] = [e1].[Id]
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])) = (
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])
ORDER BY [e1].[Id]) = (
SELECT TOP(1) [e2].[Id]
FROM [JoinThreeToCompositeKeyFull] AS [j0]
INNER JOIN [EntityThrees] AS [e2] ON [j0].[ThreeId] = [e2].[Id]
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3]))
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3])
ORDER BY [e2].[Id])
ORDER BY [e].[Key1], [e0].[Key1]");
}

Expand Down Expand Up @@ -551,7 +554,7 @@ FROM [EntityThrees] AS [e]
LEFT JOIN (
SELECT [t].[Key1], [t].[Key2], [t].[Key3], [t].[Name], [t].[ThreeId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3]
FROM (
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3]) AS [row]
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1]) AS [row]
FROM [JoinThreeToCompositeKeyFull] AS [j]
INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3])
) AS [t]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ORDER BY (
SELECT COUNT_BIG(*)
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e0] ON [j].[LeftId] = [e0].[Id]
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC");
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC, [e].[Id]");
}

public override async Task Skip_navigation_select_many_average(bool async)
Expand Down Expand Up @@ -394,7 +394,8 @@ FROM [EntityTwos] AS [e]
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[RightId] = [e1].[Id]
WHERE [e0].[Id] = [j].[LeftId])");
WHERE [e0].[Id] = [j].[LeftId]
ORDER BY [e1].[Id])");
}

public override async Task Left_join_with_skip_navigation(bool async)
Expand All @@ -408,11 +409,13 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON (
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoToCompositeKeyShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[TwoId] = [e1].[Id]
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])) = (
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])
ORDER BY [e1].[Id]) = (
SELECT TOP(1) [e2].[Id]
FROM [JoinThreeToCompositeKeyFull] AS [j0]
INNER JOIN [EntityThrees] AS [e2] ON [j0].[ThreeId] = [e2].[Id]
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3]))
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3])
ORDER BY [e2].[Id])
ORDER BY [e].[Key1], [e0].[Key1]");
}

Expand Down Expand Up @@ -598,7 +601,7 @@ FROM [EntityThrees] AS [e]
LEFT JOIN (
SELECT [t].[Key1], [t].[Key2], [t].[Key3], [t].[Name], [t].[ThreeId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3]
FROM (
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3]) AS [row]
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1]) AS [row]
FROM [JoinThreeToCompositeKeyFull] AS [j]
INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3])
) AS [t]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ORDER BY (
SELECT COUNT_BIG(*)
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e0] ON [j].[LeftId] = [e0].[Id]
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC");
WHERE ([e].[Id] = [j].[RightId]) AND ([e0].[Name] IS NOT NULL AND ([e0].[Name] LIKE N'L%'))) DESC, [e].[Id]");
}

public override async Task Skip_navigation_select_many_average(bool async)
Expand Down Expand Up @@ -394,7 +394,8 @@ FROM [EntityTwos] AS [e]
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoSelfShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[RightId] = [e1].[Id]
WHERE [e0].[Id] = [j].[LeftId])");
WHERE [e0].[Id] = [j].[LeftId]
ORDER BY [e1].[Id])");
}

public override async Task Left_join_with_skip_navigation(bool async)
Expand All @@ -408,11 +409,13 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON (
SELECT TOP(1) [e1].[Id]
FROM [JoinTwoToCompositeKeyShared] AS [j]
INNER JOIN [EntityTwos] AS [e1] ON [j].[TwoId] = [e1].[Id]
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])) = (
WHERE (([e].[Key1] = [j].[CompositeId1]) AND ([e].[Key2] = [j].[CompositeId2])) AND ([e].[Key3] = [j].[CompositeId3])
ORDER BY [e1].[Id]) = (
SELECT TOP(1) [e2].[Id]
FROM [JoinThreeToCompositeKeyFull] AS [j0]
INNER JOIN [EntityThrees] AS [e2] ON [j0].[ThreeId] = [e2].[Id]
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3]))
WHERE (([e0].[Key1] = [j0].[CompositeId1]) AND ([e0].[Key2] = [j0].[CompositeId2])) AND ([e0].[Key3] = [j0].[CompositeId3])
ORDER BY [e2].[Id])
ORDER BY [e].[Key1], [e0].[Key1]");
}

Expand Down Expand Up @@ -598,7 +601,7 @@ FROM [EntityThrees] AS [e]
LEFT JOIN (
SELECT [t].[Key1], [t].[Key2], [t].[Key3], [t].[Name], [t].[ThreeId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3]
FROM (
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3]) AS [row]
SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1]) AS [row]
FROM [JoinThreeToCompositeKeyFull] AS [j]
INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3])
) AS [t]
Expand Down