Skip to content

Commit fa2bb0a

Browse files
committed
Fix SQL Server tests
1 parent 052d3c0 commit fa2bb0a

50 files changed

Lines changed: 967 additions & 196 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/cosmos-provider/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Non-relational provider with its own parallel query pipeline. Uses JSON for docu
1919
## Azure Cosmos DB Emulator for Tests
2020

2121
- `TestEnvironment.InitializeAsync()` auto-starts a `Testcontainers.CosmosDb` container when `Test__Cosmos__DefaultConnection` is not set. Set the env var to use an existing emulator instead.
22-
- Skip tests requiring unsupported features on the Linux emulator with `[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]`.
22+
- Skip tests requiring unsupported features on the Linux emulator with ` [ConditionalFact(typeof(CosmosTestEnvironment), nameof(CosmosTestEnvironment.IsNotLinuxEmulator))]`.

azure-pipelines-internal-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ extends:
197197
- job: Linux_Cosmos
198198
displayName: 'Linux Cosmos'
199199
condition: notin(variables['Build.Reason'], 'PullRequest', 'Schedule')
200-
timeoutInMinutes: 210
200+
timeoutInMinutes: 300
201201
pool:
202202
name: $(DncEngInternalBuildPool)
203203
demands: ImageOverride -equals 1es-ubuntu-2204

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<OpenTelemetryExporterInMemoryVersion>1.15.1</OpenTelemetryExporterInMemoryVersion>
5353
<SQLitePCLRawVersion>3.0.3</SQLitePCLRawVersion>
5454
<SQLite3MCPCLRawBundleVersion>2.3.2</SQLite3MCPCLRawBundleVersion>
55+
<XUnitV3Version>4.0.0-pre.108</XUnitV3Version>
5556
<MicrosoftDotNetXUnitV3ExtensionsVersion>11.0.0-beta.26263.112</MicrosoftDotNetXUnitV3ExtensionsVersion>
5657
<MicrosoftTestingPlatformVersion>2.2.2</MicrosoftTestingPlatformVersion>
5758
</PropertyGroup>

global.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
],
1010
"errorMessage": "The required .NET SDK wasn't found. Please run ./restore.sh or .\\restore.cmd to install it."
1111
},
12+
"test": {
13+
"runner": "Microsoft.Testing.Platform"
14+
},
1215
"tools": {
1316
"dotnet": "11.0.100-preview.5.26227.104",
1417
"runtimes": {

src/EFCore/Metadata/Internal/ForeignKey.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ public virtual IDependentKeyValueFactory DependentKeyValueFactory
951951
if (field == null)
952952
{
953953
EnsureReadOnly();
954+
((IKey)PrincipalKey).GetPrincipalKeyValueFactory();
954955
}
955956

956957
return field!;

src/EFCore/Metadata/RuntimeForeignKey.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,25 @@ IEnumerable<IReadOnlySkipNavigation> IReadOnlyForeignKey.GetReferencingSkipNavig
259259
/// <inheritdoc />
260260
[DebuggerStepThrough]
261261
IDependentKeyValueFactory<TKey> IForeignKey.GetDependentKeyValueFactory<TKey>()
262-
=> (IDependentKeyValueFactory<TKey>)_dependentKeyValueFactory!;
262+
=> (IDependentKeyValueFactory<TKey>)((IRuntimeForeignKey)this).DependentKeyValueFactory;
263263

264264
/// <inheritdoc />
265265
[DebuggerStepThrough]
266266
IDependentKeyValueFactory IForeignKey.GetDependentKeyValueFactory()
267-
=> _dependentKeyValueFactory!;
267+
=> ((IRuntimeForeignKey)this).DependentKeyValueFactory;
268268

269269
/// <inheritdoc />
270270
IDependentKeyValueFactory IRuntimeForeignKey.DependentKeyValueFactory
271271
{
272272
[DebuggerStepThrough]
273-
get => _dependentKeyValueFactory!;
273+
get
274+
{
275+
if (_dependentKeyValueFactory == null)
276+
{
277+
((IKey)PrincipalKey).GetPrincipalKeyValueFactory();
278+
}
279+
return _dependentKeyValueFactory!;
280+
}
274281

275282
[DebuggerStepThrough]
276283
set => _dependentKeyValueFactory = value;

test/Directory.Build.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\rulesets\EFCore.test.ruleset</CodeAnalysisRuleSet>
77
<LangVersion>preview</LangVersion>
88
<NuGetAudit>false</NuGetAudit>
9+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
910
</PropertyGroup>
1011

11-
<PropertyGroup Condition="'$(IsUnitTestProject)' == 'true'">
12+
<PropertyGroup Condition="'$(IsTestProject)' != 'false'">
13+
<OutputType>Exe</OutputType>
1214
<TestRunnerName>XUnitV3</TestRunnerName>
1315
</PropertyGroup>
1416

test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<Nullable>disable</Nullable>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<IsPackable>true</IsPackable>
11+
<!-- This project contains base tests to be used by providers, but is not itself a test project with
12+
tests to be executed. Disable test discovery. -->
13+
<IsTestProject>false</IsTestProject>
1114
<IncludeSymbols>true</IncludeSymbols>
1215
<ImplicitUsings>true</ImplicitUsings>
1316
<NoWarn>$(NoWarn);8981</NoWarn>

test/EFCore.Cosmos.FunctionalTests/Query/Translations/VectorSearchTranslationsCosmosTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Microsoft.EntityFrameworkCore.Query.Translations;
88

9-
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
9+
[ConditionalClass(typeof(CosmosTestEnvironment), nameof(CosmosTestEnvironment.IsNotLinuxEmulator))]
1010
public class VectorSearchTranslationsCosmosTest : IClassFixture<VectorSearchTranslationsCosmosTest.VectorSearchFixture>
1111
{
1212
public VectorSearchTranslationsCosmosTest(VectorSearchFixture fixture, ITestOutputHelper testOutputHelper)

test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ WHERE DATEDIFF(millisecond, [m].[TimeSpanAsTime], @timeSpan) = 0
814814
public virtual void Can_query_using_DateDiffMicrosecond_using_TimeSpan()
815815
{
816816
using var context = CreateContext();
817-
var timeSpan = new TimeSpan(2, 1, 0);
817+
var timeSpan = new TimeSpan(11, 15, 13);
818818

819819
var results
820820
= context.Set<MappedNullableDataTypes>()
@@ -825,7 +825,7 @@ var results
825825
Assert.Empty(results);
826826
AssertSql(
827827
"""
828-
@timeSpan='02:01:00' (Nullable = true)
828+
@timeSpan='11:15:13' (Nullable = true)
829829
830830
SELECT [m].[Int]
831831
FROM [MappedNullableDataTypes] AS [m]
@@ -837,7 +837,7 @@ WHERE DATEDIFF(microsecond, [m].[TimeSpanAsTime], @timeSpan) = 0
837837
public virtual void Can_query_using_DateDiffNanosecond_using_TimeSpan()
838838
{
839839
using var context = CreateContext();
840-
var timeSpan = new TimeSpan(2, 1, 0);
840+
var timeSpan = new TimeSpan(11, 15, 13);
841841

842842
var results
843843
= context.Set<MappedNullableDataTypes>()
@@ -848,7 +848,7 @@ var results
848848
Assert.Empty(results);
849849
AssertSql(
850850
"""
851-
@timeSpan='02:01:00' (Nullable = true)
851+
@timeSpan='11:15:13' (Nullable = true)
852852
853853
SELECT [m].[Int]
854854
FROM [MappedNullableDataTypes] AS [m]

0 commit comments

Comments
 (0)