diff --git a/sqlx-mysql/src/protocol/connect/auth_switch.rs b/sqlx-mysql/src/protocol/connect/auth_switch.rs index 7ecb1b2b17..39f03bbf2a 100644 --- a/sqlx-mysql/src/protocol/connect/auth_switch.rs +++ b/sqlx-mysql/src/protocol/connect/auth_switch.rs @@ -81,9 +81,14 @@ fn test_decode_auth_switch_cleartext_disabled() { let e = AuthSwitchRequest::decode_with(AUTH_SWITCH_CLEARTEXT.into(), false).unwrap_err(); - assert_eq!( - e.to_string(), - "encountered unexpected or invalid data: mysql_cleartext_plugin disabled" + let e_str = e.to_string(); + + let expected = "encountered unexpected or invalid data: mysql_cleartext_plugin disabled"; + + assert!( + // Don't want to assert the full string since it contains the module path now. + e_str.starts_with(expected), + "expected error string to start with {expected:?}, got {e_str:?}" ); } diff --git a/sqlx-mysql/src/protocol/connect/handshake.rs b/sqlx-mysql/src/protocol/connect/handshake.rs index 84afe74ea6..e28a142a77 100644 --- a/sqlx-mysql/src/protocol/connect/handshake.rs +++ b/sqlx-mysql/src/protocol/connect/handshake.rs @@ -94,11 +94,12 @@ impl ProtocolDecode<'_> for Handshake { fn test_decode_handshake_mysql_8_0_18() { const HANDSHAKE_MYSQL_8_0_18: &[u8] = b"\n8.0.18\x00\x19\x00\x00\x00\x114aB0c\x06g\x00\xff\xff\xff\x02\x00\xff\xc7\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00tL\x03s\x0f[4\rl4. \x00caching_sha2_password\x00"; - let mut p = Handshake::decode(HANDSHAKE_MYSQL_8_0_18.into()).unwrap(); + let p = Handshake::decode(HANDSHAKE_MYSQL_8_0_18.into()).unwrap(); assert_eq!(p.protocol_version, 10); - p.server_capabilities.toggle( + assert_eq!( + p.server_capabilities, Capabilities::MYSQL | Capabilities::FOUND_ROWS | Capabilities::LONG_FLAG @@ -128,8 +129,6 @@ fn test_decode_handshake_mysql_8_0_18() { | Capabilities::REMEMBER_OPTIONS, ); - assert!(p.server_capabilities.is_empty()); - assert_eq!(p.server_default_collation, 255); assert!(p.status.contains(Status::SERVER_STATUS_AUTOCOMMIT)); @@ -148,7 +147,7 @@ fn test_decode_handshake_mysql_8_0_18() { fn test_decode_handshake_mariadb_10_4_7() { const HANDSHAKE_MARIA_DB_10_4_7: &[u8] = b"\n5.5.5-10.4.7-MariaDB-1:10.4.7+maria~bionic\x00\x0b\x00\x00\x00t6L\\j\"dS\x00\xfe\xf7\x08\x02\x00\xff\x81\x15\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00U14Oph9\"