25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { describe, expect, it } from "vitest";
import { shouldMarkDisconnected } from "@/lib/connection/connectionHealth";
describe("connectionHealth", () => {
it("marks localized and JDBC communication errors as disconnected", () => {
expect(shouldMarkDisconnected("Agent RPC error (-1): dm.jdbc.driver.DMException: 网络通信异常")).toBe(true);
expect(shouldMarkDisconnected("Agent RPC error (-1): com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure")).toBe(true);
expect(shouldMarkDisconnected("Agent RPC error (-1): java.sql.SQLRecoverableException: IO 错误: Got minus one from a read call")).toBe(true);
});
it("does not mark ordinary SQL or authentication errors as disconnected", () => {
expect(shouldMarkDisconnected("syntax error at or near SELECT")).toBe(false);
expect(shouldMarkDisconnected("Access denied for user root")).toBe(false);
});
it("marks transient etcd gRPC failures as disconnected", () => {
expect(shouldMarkDisconnected("ETCD_CONNECTION_UNAVAILABLE: etcd is temporarily unavailable")).toBe(true);
expect(shouldMarkDisconnected("io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED")).toBe(true);
expect(shouldMarkDisconnected("ETCD_PERMISSION_DENIED: not authorized")).toBe(false);
});
});