From adbe64a7995b0e22381a2af704883e8de1fe72ce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 07:49:47 +0000 Subject: [PATCH 1/3] Initial plan From 9e70afcee04978d723a3d6223c90985f756d94b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 07:56:02 +0000 Subject: [PATCH 2/3] Fix test assertions to handle both connection failure and authentication failure Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com> --- tests/SuperSocket.MySQL.Test/MainTest.cs | 8 +++++++- tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/SuperSocket.MySQL.Test/MainTest.cs b/tests/SuperSocket.MySQL.Test/MainTest.cs index 00e1b13..0fcca43 100644 --- a/tests/SuperSocket.MySQL.Test/MainTest.cs +++ b/tests/SuperSocket.MySQL.Test/MainTest.cs @@ -41,7 +41,13 @@ public async Task ConnectAsync_WithInvalidCredentials_ShouldThrowException() async () => await connection.ConnectAsync() ); - Assert.Contains("authentication failed", exception.Message.ToLower()); + // The exception message should indicate either: + // - authentication failed (when MySQL is running but credentials are wrong) + // - connection failed (when MySQL is not running) + var lowerMessage = exception.Message.ToLower(); + Assert.True( + lowerMessage.Contains("authentication failed") || lowerMessage.Contains("failed to connect"), + $"Expected 'authentication failed' or 'failed to connect' but got: {exception.Message}"); Assert.False(connection.IsAuthenticated, "Connection should not be authenticated after failed handshake"); } diff --git a/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs b/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs index d0381a1..ac3d64c 100644 --- a/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs +++ b/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs @@ -47,7 +47,13 @@ public async Task MySQLConnection_InvalidCredentials_ShouldFailHandshake() async () => await connection.ConnectAsync() ); - Assert.Contains("authentication failed", exception.Message.ToLower()); + // The exception message should indicate either: + // - authentication failed (when MySQL is running but credentials are wrong) + // - connection failed (when MySQL is not running) + var lowerMessage = exception.Message.ToLower(); + Assert.True( + lowerMessage.Contains("authentication failed") || lowerMessage.Contains("failed to connect"), + $"Expected 'authentication failed' or 'failed to connect' but got: {exception.Message}"); Assert.False(connection.IsAuthenticated, "Connection should not be authenticated after failed handshake"); } From 91162f95eddac97c1a89280757150ba922899ca6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 08:25:46 +0000 Subject: [PATCH 3/3] Revert test changes - the issue is a bug in MySQLConnection, not the tests Co-authored-by: kerryjiang <456060+kerryjiang@users.noreply.github.com> --- tests/SuperSocket.MySQL.Test/MainTest.cs | 8 +------- tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/SuperSocket.MySQL.Test/MainTest.cs b/tests/SuperSocket.MySQL.Test/MainTest.cs index 0fcca43..00e1b13 100644 --- a/tests/SuperSocket.MySQL.Test/MainTest.cs +++ b/tests/SuperSocket.MySQL.Test/MainTest.cs @@ -41,13 +41,7 @@ public async Task ConnectAsync_WithInvalidCredentials_ShouldThrowException() async () => await connection.ConnectAsync() ); - // The exception message should indicate either: - // - authentication failed (when MySQL is running but credentials are wrong) - // - connection failed (when MySQL is not running) - var lowerMessage = exception.Message.ToLower(); - Assert.True( - lowerMessage.Contains("authentication failed") || lowerMessage.Contains("failed to connect"), - $"Expected 'authentication failed' or 'failed to connect' but got: {exception.Message}"); + Assert.Contains("authentication failed", exception.Message.ToLower()); Assert.False(connection.IsAuthenticated, "Connection should not be authenticated after failed handshake"); } diff --git a/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs b/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs index ac3d64c..d0381a1 100644 --- a/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs +++ b/tests/SuperSocket.MySQL.Test/MySQLIntegrationTest.cs @@ -47,13 +47,7 @@ public async Task MySQLConnection_InvalidCredentials_ShouldFailHandshake() async () => await connection.ConnectAsync() ); - // The exception message should indicate either: - // - authentication failed (when MySQL is running but credentials are wrong) - // - connection failed (when MySQL is not running) - var lowerMessage = exception.Message.ToLower(); - Assert.True( - lowerMessage.Contains("authentication failed") || lowerMessage.Contains("failed to connect"), - $"Expected 'authentication failed' or 'failed to connect' but got: {exception.Message}"); + Assert.Contains("authentication failed", exception.Message.ToLower()); Assert.False(connection.IsAuthenticated, "Connection should not be authenticated after failed handshake"); }