feat: 18 引擎驱动全家桶 + 驱动管理/离线包 + 设置中心 + 工作台交互打磨
驱动接入(全部本机真实例验收): - Elasticsearch 原生 SQL API、InfluxDB 原生 HTTP+Flux(官方 JDBC 付费许可,实测弃用) - ZooKeeper/MongoDB JVM agent(连接时自动下载官方驱动 jar,sha256 钉版本到 ~/.opsxdb/drivers/) - 达梦 JDBC agent 桥就绪(待厂商 jar+实例);TiDB 真实例验收 - 协议族代码审查放行 PolarDB/TDSQL/OceanBase/Kingbase/GaussDB/Oracle - 驱动能力模型:按驱动开关对象树分组/右键菜单/行编辑,NoSQL 树拍平(对象直挂库节点) 驱动管理: - 驱动管理弹框(状态/预装/离线包导入/JDK 检测)+ /api/drivers/* 三接口 - opsxdb-driver 驱动商店仓库(清单/fetch.sh/pack.sh 离线包/import.sh) - 连接时懒加载:DMG 零 Java 产物,首连自动下载(实测 ZK 九件套 1.35s),离线包自动回退 UI/交互: - 设置中心(⚙):常规/执行/结果/驱动/快捷键/关于,左导航+右面板(对标 opsxshell) - 实例级展开箭头(行首 SVG chevron,替代字体回退失真的 Unicode 三角) - 树内嵌套渲染修复:对象树挂在激活连接下;工具栏窄窗口不断行(按钮 nowrap+整颗换行) - 侧栏连接行精简(图标+连接名)、SQLite SSH 守卫、Oracle 死参数清理 质量: - Go 协议层/离线回退单测、E2E 门控测试(ES/ZK/Influx/Mongo/TiDB/JDBC 桥) - 驱动注册表单一事实来源 connection-types.json,README/BACKLOG/AGENTS 同步
This commit is contained in:
1 parent
26f459d1b8
commit
a9510235bb
156 files changed
+17200
-2520
No files matched your search
@@ -0,0 +1,72 @@
|
||||
package db
|
||||
|
||||
// family_e2e_test.go —— 协议兼容族真实例验收(MySQL 族:TiDB;PG 族:openGauss)。
|
||||
// 触发:OPSXDB_E2E_TIDB=1 / OPSXDB_E2E_GAUSS=1;验证族内真实例后注册表才可翻 verified。
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestE2ETiDB —— 真实 TiDB(pingcap/tidb 单容器,MySQL 协议族)。
|
||||
func TestE2ETiDB(t *testing.T) {
|
||||
if os.Getenv("OPSXDB_E2E_TIDB") != "1" {
|
||||
t.Skip("置 OPSXDB_E2E_TIDB=1 并启动 TiDB :4000 后运行(docker run -p 4000:4000 pingcap/tidb:v7.5.0)")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
|
||||
c := ConnReq{Driver: "tidb", Host: "127.0.0.1", Port: 4000, User: "root"}
|
||||
if err := TestConnection(c); err != nil {
|
||||
t.Skipf("TiDB :4000 不可达: %v", err)
|
||||
}
|
||||
dbs, err := ListDatabases(ctx, c)
|
||||
if err != nil || len(dbs) == 0 {
|
||||
t.Fatalf("ListDatabases = %v, %v", dbs, err)
|
||||
}
|
||||
// 建库建表写读
|
||||
must := func(sql string, db string) ExecResult {
|
||||
t.Helper()
|
||||
return ExecSQL(ctx, ConnReq{Driver: "tidb", Host: "127.0.0.1", Port: 4000, User: "root", Database: db, SQL: sql, ConfirmDanger: true})
|
||||
}
|
||||
if r := must("CREATE DATABASE IF NOT EXISTS opsxe2e", ""); r.Error != "" {
|
||||
t.Fatalf("create db: %s", r.Error)
|
||||
}
|
||||
if r := must("CREATE TABLE IF NOT EXISTS fam_t(id INT PRIMARY KEY, name VARCHAR(32))", "opsxe2e"); r.Error != "" {
|
||||
t.Fatalf("create table: %s", r.Error)
|
||||
}
|
||||
if r := must(`INSERT INTO fam_t VALUES (1, 'tidb-ok')`, "opsxe2e"); r.Error != "" {
|
||||
t.Fatalf("insert: %s", r.Error)
|
||||
}
|
||||
r := must("SELECT * FROM fam_t", "opsxe2e")
|
||||
if r.Error != "" || r.RowCount != 1 || r.Rows[0]["name"] != "tidb-ok" {
|
||||
t.Fatalf("select: err=%s rows=%+v", r.Error, r.Rows)
|
||||
}
|
||||
}
|
||||
|
||||
// TestE2EOpenGauss —— 真实 openGauss(PG 协议族;Apple Silicon 需 --platform linux/amd64)。
|
||||
func TestE2EOpenGauss(t *testing.T) {
|
||||
if os.Getenv("OPSXDB_E2E_GAUSS") != "1" {
|
||||
t.Skip("置 OPSXDB_E2E_GAUSS=1 并启动 openGauss :5432 后运行")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
|
||||
c := ConnReq{Driver: "gaussdb", Host: "127.0.0.1", Port: 5432, User: "omm", Password: "Demo@123", Database: "postgres"}
|
||||
if err := TestConnection(c); err != nil {
|
||||
t.Skipf("openGauss :5432 不可达: %v", err)
|
||||
}
|
||||
dbs, err := ListDatabases(ctx, c)
|
||||
if err != nil || len(dbs) == 0 {
|
||||
t.Fatalf("ListDatabases = %v, %v", dbs, err)
|
||||
}
|
||||
q := ExecSQL(ctx, ConnReq{Driver: "gaussdb", Host: "127.0.0.1", Port: 5432, User: "omm", Password: "Demo@123", Database: "postgres", SQL: "SELECT 1 AS one"})
|
||||
if q.Error != "" {
|
||||
t.Fatalf("select: %s", q.Error)
|
||||
}
|
||||
if q.RowCount != 1 {
|
||||
t.Fatalf("rows = %+v", q.Rows)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user