Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lauxjpn committed Mar 16, 2024
1 parent 3776494 commit daa030c
Showing 1 changed file with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.BulkUpdates;
using Microsoft.EntityFrameworkCore.TestUtilities;
using MySqlConnector;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using Pomelo.EntityFrameworkCore.MySql.Tests;
using Xunit;

namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates;
Expand Down Expand Up @@ -89,27 +92,35 @@ public override async Task Delete_GroupBy_Where_Select_First_2(bool async)

public override async Task Delete_GroupBy_Where_Select_First_3(bool async)
{
// Not supported by MySQL:
// Error Code: 1093. You can't specify target table 'c' for update in FROM clause
await Assert.ThrowsAsync<MySqlException>(
() => base.Delete_GroupBy_Where_Select_First_3(async));
if (AppConfig.ServerVersion.Type == ServerType.MariaDb &&
AppConfig.ServerVersion.Version >= new Version(11, 1))
{
await base.Delete_GroupBy_Where_Select_First_3(async);

AssertSql(
AssertSql(

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.3.2-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.3.2-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.3.2-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.3.2-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.2.3-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.2.3-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.2.3-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.2.3-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.1.4-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.1.4-mariadb, ubuntu-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 65) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\n SELECT (\n SELECT··· Actual: ···CountryId` = 1) AND EXISTS (\n SELECT 1\n FROM `Animals` ··· ↑ (pos 65)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.1.4-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: True)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)

Check failure on line 100 in test/EFCore.MySql.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesMySqlTest.cs

View workflow job for this annotation

GitHub Actions / BuildAndTest (11.1.4-mariadb, windows-latest)

Pomelo.EntityFrameworkCore.MySql.FunctionalTests.BulkUpdates.FiltersInheritanceBulkUpdatesMySqlTest.Delete_GroupBy_Where_Select_First_3(async: False)

Assert.Equal() Failure ↓ (pos 67) Expected: ···CountryId` = 1) AND `a`.`Id` IN (\r\n SELECT (\r\n SELE··· Actual: ···CountryId` = 1) AND EXISTS (\r\n SELECT 1\r\n FROM `Animals··· ↑ (pos 67)
"""
DELETE `a`
FROM `Animals` AS `a`
WHERE (`a`.`CountryId` = 1) AND EXISTS (
SELECT 1
FROM `Animals` AS `a0`
WHERE `a0`.`CountryId` = 1
GROUP BY `a0`.`CountryId`
HAVING (COUNT(*) < 3) AND ((
WHERE (`a`.`CountryId` = 1) AND `a`.`Id` IN (
SELECT (
SELECT `a1`.`Id`
FROM `Animals` AS `a1`
WHERE (`a1`.`CountryId` = 1) AND (`a0`.`CountryId` = `a1`.`CountryId`)
LIMIT 1) = `a`.`Id`))
"""
);
LIMIT 1)
FROM `Animals` AS `a0`
WHERE `a0`.`CountryId` = 1
GROUP BY `a0`.`CountryId`
HAVING COUNT(*) < 3
)
""");
}
else
{
// Not supported by MySQL:
// Error Code: 1093. You can't specify target table 'c' for update in FROM clause
await Assert.ThrowsAsync<MySqlException>(
() => base.Delete_GroupBy_Where_Select_First_3(async));
}
}

public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async)
Expand Down

0 comments on commit daa030c

Please sign in to comment.