Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<EFCoreVersion>11.0.0-preview.5.26267.102</EFCoreVersion>
<MicrosoftExtensionsVersion>11.0.0-preview.5.26267.102</MicrosoftExtensionsVersion>
<MicrosoftExtensionsConfigurationVersion>11.0.0-preview.5.26267.102</MicrosoftExtensionsConfigurationVersion>
<EFCoreVersion>11.0.0-preview.5.26275.101</EFCoreVersion>
<MicrosoftExtensionsVersion>11.0.0-preview.5.26275.101</MicrosoftExtensionsVersion>
<MicrosoftExtensionsConfigurationVersion>11.0.0-preview.5.26275.101</MicrosoftExtensionsConfigurationVersion>
<NpgsqlVersion>10.0.0</NpgsqlVersion>
</PropertyGroup>

Expand All @@ -28,6 +28,7 @@

<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="xunit.v3" Version="4.0.0-pre.108" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.9.3" />
<PackageVersion Include="xunit.core" Version="2.9.3" />
Expand Down
3 changes: 3 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<packageSource key="dotnet11">
<package pattern="*" />
</packageSource>
<packageSource key="dotnet-eng">
<package pattern="Microsoft.DotNet.*" />
</packageSource>
</packageSourceMapping>

</configuration>
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"version": "11.0.100-preview.4.26210.111",
"rollForward": "latestMinor",
"allowPrerelease": true
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
12 changes: 9 additions & 3 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>

<!-- There's lots of use of internal EF Core APIs from the tests, suppress the analyzer warnings for those -->
<NoWarn>$(NoWarn);xUnit1003;xUnit1004;xUnit1013;xUnit1024;EF1001</NoWarn>
<NoWarn>$(NoWarn);CS0618;xUnit1003;xUnit1004;xUnit1013;xUnit1024;xUnit1051;EF1001</NoWarn>
</PropertyGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TestRunnerName>XUnitV3</TestRunnerName>
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --filter-not-trait category=failing --ignore-exit-code 8</TestingPlatformCommandLineArguments>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="GitHubActionsTestLogger" />
<PackageReference Include="Npgsql" />
Expand All @@ -24,7 +31,6 @@

<ItemGroup>
<Using Include="Xunit" />
<Using Include="Xunit.Abstractions" />
<Using Include="Microsoft.EntityFrameworkCore.TestUtilities" />
<Using Include="Microsoft.EntityFrameworkCore.TestUtilities.Xunit" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/EFCore.PG.FunctionalTests/ComputedColumnTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ public void Can_use_computed_columns_with_nullable_enum()

protected NpgsqlTestStore TestStore { get; private set; } = null!;

public async Task InitializeAsync()
public async ValueTask InitializeAsync()
=> TestStore = await NpgsqlTestStore.CreateInitializedAsync("ComputedColumnTest");

public async Task DisposeAsync()
public async ValueTask DisposeAsync()
=> await TestStore.DisposeAsync();
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public virtual CompatibilityContext CreateRedshiftContext()
return new CompatibilityContext(builder.Options);
}

public virtual async Task InitializeAsync()
public virtual async ValueTask InitializeAsync()
{
_testStore = NpgsqlTestStoreFactory.Instance.GetOrCreate(StoreName);
await _testStore.InitializeAsync(null, CreateContext, c => CompatibilityContext.SeedAsync((CompatibilityContext)c));
Expand All @@ -85,7 +85,7 @@ public virtual void Dispose()
{
}

public virtual async Task DisposeAsync()
public virtual async ValueTask DisposeAsync()
=> await _testStore.DisposeAsync();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public LegacyTimestampQueryFixture()
NpgsqlTypeMappingSource.LegacyTimestampBehavior = true;
}

public override Task DisposeAsync()
public override ValueTask DisposeAsync()
{
NpgsqlTypeMappingSource.LegacyTimestampBehavior = false;
return Task.CompletedTask;
return ValueTask.CompletedTask;
}

protected override async Task SeedAsync(TimestampQueryContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ WHERE c."ContactName" NOT ILIKE '%M%' OR c."ContactName" IS NULL
#region Collation

[MinimumPostgresVersion(12, 0)]
[PlatformSkipCondition(TestUtilities.Xunit.TestPlatform.Windows, SkipReason = "ICU non-deterministic doesn't seem to work on Windows?")]
[SkipOnPlatform(TestPlatforms.Windows, "ICU non-deterministic doesn't seem to work on Windows?")]
public override async Task Collate_case_insensitive(bool async)
{
await base.Collate_case_insensitive(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ protected override ITestStoreFactory TestStoreFactory
public new NpgsqlTestStore TestStore
=> (NpgsqlTestStore)base.TestStore;

public override async Task InitializeAsync()
public override async ValueTask InitializeAsync()
{
await base.InitializeAsync();
await TestStore.ExecuteNonQueryAsync("CREATE SCHEMA IF NOT EXISTS db2");
Expand Down
4 changes: 2 additions & 2 deletions test/EFCore.PG.FunctionalTests/SequenceEndToEndTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ private class Unicon

protected NpgsqlTestStore TestStore { get; private set; } = null!;

public async Task InitializeAsync()
public async ValueTask InitializeAsync()
=> TestStore = await NpgsqlTestStore.CreateInitializedAsync("SequenceEndToEndTest");

public async Task DisposeAsync()
public async ValueTask DisposeAsync()
=> await TestStore.DisposeAsync();
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
namespace Microsoft.EntityFrameworkCore.TestUtilities;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public sealed class MinimumPostgresVersionAttribute(int major, int minor) : Attribute, ITestCondition
public sealed class MinimumPostgresVersionAttribute(int major, int minor) : Attribute, global::Xunit.v3.ITraitAttribute
{
private readonly Version _version = new(major, minor);

public ValueTask<bool> IsMetAsync()
=> new(TestEnvironment.PostgresVersion >= _version);
private bool IsMet
=> TestEnvironment.PostgresVersion >= _version;

public string SkipReason
=> $"Requires PostgreSQL version {_version} or later.";

public IReadOnlyCollection<KeyValuePair<string, string>> GetTraits()
=> IsMet ? [] : [new("category", "failing")];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
namespace Microsoft.EntityFrameworkCore.TestUtilities;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public sealed class RequiresPostgisAttribute : Attribute, ITestCondition
public sealed class RequiresPostgisAttribute : Attribute, global::Xunit.v3.ITraitAttribute
{
public ValueTask<bool> IsMetAsync()
=> new(TestEnvironment.IsPostgisAvailable || Environment.GetEnvironmentVariable("NPGSQL_TEST_POSTGIS")?.ToLower(CultureInfo.InvariantCulture) is "1" or "true");
private static bool IsMet
=> TestEnvironment.IsPostgisAvailable
|| Environment.GetEnvironmentVariable("NPGSQL_TEST_POSTGIS")?.ToLower(CultureInfo.InvariantCulture) is "1" or "true";

public string SkipReason
=> "PostGIS isn't installed, skipping";

public IReadOnlyCollection<KeyValuePair<string, string>> GetTraits()
=> IsMet ? [] : [new("category", "failing")];
}
Loading