Skip to content

Commit 15ed3df

Browse files
committed
Allow tests to ignore value of exception number.
Azure Database for MySQL doesn't consistently populate this value.
1 parent 94ff788 commit 15ed3df

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/SideBySide/ConnectSync.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void ConnectBadDatabase()
6363
// https://bugs.mysql.com/bug.php?id=78426
6464
Assert.NotNull(ex);
6565
#else
66-
Assert.Equal((int) MySqlErrorCode.UnknownDatabase, ex.Number);
66+
if (AppConfig.SupportedFeatures.HasFlag(ServerFeatures.ErrorCodes) || ex.Number != 0)
67+
Assert.Equal((int) MySqlErrorCode.UnknownDatabase, ex.Number);
6768
#endif
6869
}
6970
Assert.Equal(ConnectionState.Closed, connection.State);
@@ -88,7 +89,8 @@ public void ConnectBadPassword()
8889
// https://bugs.mysql.com/bug.php?id=73610
8990
Assert.NotNull(ex);
9091
#else
91-
Assert.Equal((int) MySqlErrorCode.AccessDenied, ex.Number);
92+
if (AppConfig.SupportedFeatures.HasFlag(ServerFeatures.ErrorCodes) || ex.Number != 0)
93+
Assert.Equal((int) MySqlErrorCode.AccessDenied, ex.Number);
9294
#endif
9395
}
9496
Assert.Equal(ConnectionState.Closed, connection.State);

tests/SideBySide/ServerFeatures.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ public enum ServerFeatures
1414
CachingSha2Password = 32,
1515
SessionTrack = 64,
1616
Timeout = 128,
17+
ErrorCodes = 256,
1718
}
1819
}

0 commit comments

Comments
 (0)