Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lauxjpn committed Mar 17, 2024
1 parent 3776494 commit 8beffa2
Showing 1 changed file with 17 additions and 7 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,12 +92,12 @@ 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(
"""
DELETE `a`
FROM `Animals` AS `a`
Expand All @@ -108,8 +111,15 @@ GROUP BY `a0`.`CountryId`
FROM `Animals` AS `a1`
WHERE (`a1`.`CountryId` = 1) AND (`a0`.`CountryId` = `a1`.`CountryId`)
LIMIT 1) = `a`.`Id`))
"""
);
""");
}
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 8beffa2

Please sign in to comment.