Skip to content

Commit

Permalink
[no-release-notes] add warning test for dotnet integration (#8445)
Browse files Browse the repository at this point in the history
  • Loading branch information
jycor authored Oct 11, 2024
1 parent 30864ef commit 1ba71c3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/cespare/xxhash/v2 v2.2.0
github.com/creasty/defaults v1.6.0
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
github.com/dolthub/go-mysql-server v0.18.2-0.20241011074701-f9668b4ea059
github.com/dolthub/go-mysql-server v0.18.2-0.20241011215835-9ee86c83dd06
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63
github.com/dolthub/swiss v0.1.0
github.com/goccy/go-json v0.10.2
Expand Down
4 changes: 2 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662 h1:aC17hZD6iwzBwwfO5M+3oBT5E5gGRiQPdn+vzpDXqIA=
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168=
github.com/dolthub/go-mysql-server v0.18.2-0.20241011074701-f9668b4ea059 h1:OgZyHBBiQdXIiE4jzIkpOgZjw0MJdbzwmfqZPbszk1c=
github.com/dolthub/go-mysql-server v0.18.2-0.20241011074701-f9668b4ea059/go.mod h1:Z8tket+3sYcU3d4yW90Ggld2d+C2DUgnpB8cBP0+GvI=
github.com/dolthub/go-mysql-server v0.18.2-0.20241011215835-9ee86c83dd06 h1:ChpThUOVwCKA/3DVfrGRnDHQb41njX2MnRVigSJbE8s=
github.com/dolthub/go-mysql-server v0.18.2-0.20241011215835-9ee86c83dd06/go.mod h1:Z8tket+3sYcU3d4yW90Ggld2d+C2DUgnpB8cBP0+GvI=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q=
github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE=
Expand Down
44 changes: 44 additions & 0 deletions integration-tests/mysql-client-tests/dotnet/MySqlClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static int Main(string[] args)
conn.Open();
SetupTest(conn);
QueryTest(conn);
WarningTest(conn);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -79,6 +80,49 @@ public static void QueryTest(MySqlConnection conn)
}
}

public static void WarningTest(MySqlConnection conn)
{
string sql = "SELECT 1/0";
using (var cmd = new MySqlCommand(sql, conn))
try
{
object result = cmd.ExecuteScalar();
if (result != null)
{
if (!DBNull.Value.Equals(result))
{
TestException ex = new TestException($"Expected NULL, Received {result}");
throw ex;
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

sql = "SHOW WARNINGS";
using (var cmd = new MySqlCommand(sql, conn))
try
{
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (reader.GetString(2) != "Division by 0")
{
TestException ex = new TestException($"Expected 'Division by 0', Received {reader.GetString(0)}");
throw ex;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

public static void DoltSqlTest(MySqlConnection conn)
{
string[] queries = new string[] {
Expand Down

0 comments on commit 1ba71c3

Please sign in to comment.