diff --git a/.github/workflows/core_build_publish.yml b/.github/workflows/core_build_publish.yml index d3edecfc..0aae0931 100644 --- a/.github/workflows/core_build_publish.yml +++ b/.github/workflows/core_build_publish.yml @@ -149,7 +149,7 @@ jobs: CORELIB_TESTS_AZURE_BLOB_STORAGE_CONTAINER_NAME: ${{ secrets.CORELIB_TESTS_AZURE_BLOB_STORAGE_CONTAINER_NAME }} CORELIB_TESTS_AZURE_TABLE_STORAGE_TABLE_NAME: ${{ secrets.CORELIB_TESTS_AZURE_TABLE_STORAGE_TABLE_NAME }} - name: Integration Test - SQL Server - run: dotnet test -- --explicit on --filter-trait 'category=integration' + run: dotnet test -- --explicit on --filter-query '/[(category=integration)&(database!=postgres)]' env: SqlServer__ConnectionStringBase: Server=localhost,1433;User Id=sa;Password=Passw12#;Encrypt=false LeanCodeIntegrationTests__Database: sqlserver diff --git a/test/LeanCode.IntegrationTests/PostgresFactAttribute.cs b/test/LeanCode.IntegrationTests/PostgresFactAttribute.cs deleted file mode 100644 index 1884fa35..00000000 --- a/test/LeanCode.IntegrationTests/PostgresFactAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using LeanCode.Test.Helpers; - -namespace LeanCode.IntegrationTests; - -public sealed class PostgresFactAttribute : IntegrationFactAttribute -{ - public PostgresFactAttribute() - { - if (Environment.GetEnvironmentVariable(TestDatabaseConfig.ConfigEnvName) != "postgres") - { - Skip = "Not running against PostgreSQL."; - } - } -} diff --git a/test/LeanCode.IntegrationTests/PostgresOnlyFactAttribute.cs b/test/LeanCode.IntegrationTests/PostgresOnlyFactAttribute.cs new file mode 100644 index 00000000..7c85420f --- /dev/null +++ b/test/LeanCode.IntegrationTests/PostgresOnlyFactAttribute.cs @@ -0,0 +1,9 @@ +using LeanCode.Test.Helpers; + +namespace LeanCode.IntegrationTests; + +public sealed class PostgresOnlyFactAttribute : IntegrationFactAttribute +{ + public override IReadOnlyCollection> GetTraits() => + base.GetTraits().Append(new("database", "postgres")).ToList(); +} diff --git a/test/LeanCode.IntegrationTests/TimestampTzTests.cs b/test/LeanCode.IntegrationTests/TimestampTzTests.cs index 7f2a539c..dfac0bcf 100644 --- a/test/LeanCode.IntegrationTests/TimestampTzTests.cs +++ b/test/LeanCode.IntegrationTests/TimestampTzTests.cs @@ -37,7 +37,7 @@ public TimestampTzTests() dbContext = null!; } - [PostgresFact] + [PostgresOnlyFact] public async Task Sorting_by_UtcTimestamp_returns_results_in_expected_order() { var orderedByUtc = await dbContext.Meetings.OrderBy(m => m.StartTime.UtcTimestamp).ToListAsync(); @@ -45,7 +45,7 @@ public async Task Sorting_by_UtcTimestamp_returns_results_in_expected_order() orderedByUtc.Should().BeEquivalentTo([meeting1, meeting2], options => options.WithStrictOrdering()); } - [PostgresFact] + [PostgresOnlyFact] public async Task Sorting_by_LocalTimestampWithoutOffset_returns_results_in_expected_order() { var orderedByLocal = await dbContext @@ -55,7 +55,7 @@ public async Task Sorting_by_LocalTimestampWithoutOffset_returns_results_in_expe orderedByLocal.Should().BeEquivalentTo([meeting2, meeting1], options => options.WithStrictOrdering()); } - [PostgresFact] + [PostgresOnlyFact] public void Sorting_by_LocalTimestampWithoutOffset_generates_SQL_with_expected_AT_TIME_ZONE_operator() { dbContext diff --git a/test/LeanCode.Test.Helpers/IntegrationFactAttribute.cs b/test/LeanCode.Test.Helpers/IntegrationFactAttribute.cs index e9ec11f5..92a880bf 100644 --- a/test/LeanCode.Test.Helpers/IntegrationFactAttribute.cs +++ b/test/LeanCode.Test.Helpers/IntegrationFactAttribute.cs @@ -11,5 +11,5 @@ public IntegrationFactAttribute() Explicit = true; } - public IReadOnlyCollection> GetTraits() => [new("category", "integration")]; + public virtual IReadOnlyCollection> GetTraits() => [new("category", "integration")]; }