fix(GOV-011): 支持 MySQL 5.7 系列健康检查

This commit is contained in:
2026-08-17 17:31:10 +08:00
parent 54499f0678
commit dc8da80809
2 changed files with 13 additions and 9 deletions
@@ -23,7 +23,7 @@ describe('基础设施只读健康客户端', () => {
expect(commands).toEqual(['CONNECT', 'PING']);
});
it('MySQL 使用固定元数据查询并校验 5.7 与数据库口径', async () => {
it('MySQL 使用固定元数据查询并返回实际 5.7.x 版本', async () => {
const queries: string[] = [];
const client = new MysqlHealthClient(
{
@@ -32,7 +32,7 @@ describe('基础设施只读健康客户端', () => {
return [
[
{
version: '5.7.42-log',
version: '5.7.41-log',
databaseName: 'a_share_analysis_dev',
charset: 'utf8mb4',
collation: 'utf8mb4_general_ci',
@@ -49,7 +49,7 @@ describe('基础设施只读健康客户端', () => {
await expect(client.check()).resolves.toEqual({
status: 'healthy',
detail: 'MySQL 5.7.42 / a_share_analysis_dev / +08:00',
detail: 'MySQL 5.7.41 / a_share_analysis_dev / +08:00',
});
expect(queries).toEqual([MYSQL_HEALTH_QUERY]);
});
@@ -76,14 +76,17 @@ describe('基础设施只读健康客户端', () => {
'a_share_analysis_dev',
);
await expect(createClient({ version: '8.0.40' }).check()).rejects.toThrow(/MySQL 5.7/);
await expect(createClient({ version: '5.7.41' }).check()).rejects.toThrow(/5\.7\.42/);
for (const version of ['5.6.51', '8.0.40', '5.7', '5.7.x']) {
await expect(createClient({ version }).check()).rejects.toThrow(/MySQL 5\.7\.x/);
}
await expect(createClient({ databaseName: 'a_share_analysis' }).check()).rejects.toThrow(
/a_share_analysis_dev/,
);
await expect(createClient({ charset: 'utf8' }).check()).rejects.toThrow(/utf8mb4/);
await expect(createClient({ collation: 'utf8mb4_0900_ai_ci' }).check()).rejects.toThrow(
/utf8mb4_general_ci/,
);
await expect(createClient({ timezone: 'SYSTEM' }).check()).rejects.toThrow(/\+08:00/);
});
it('MySQL 按当前配置校验生产库名', async () => {