feat(opentenbase): add PostgreSQL-compatible database support
This commit is contained in:
16 files changed
+412
-19
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { connectionProfileForScheme, parseConnectionUrl } from "@/lib/connection/connectionUrl";
|
||||
|
||||
describe("OpenTenBase connection URLs", () => {
|
||||
it("parses the OpenTenBase alias as a PostgreSQL-compatible profile", () => {
|
||||
const parsed = parseConnectionUrl("opentenbase://opentenbase:secret@cn.example.com/postgres");
|
||||
|
||||
expect(parsed).toMatchObject({
|
||||
dbType: "postgres",
|
||||
driverProfile: "opentenbase",
|
||||
driverLabel: "OpenTenBase",
|
||||
host: "cn.example.com",
|
||||
port: 11000,
|
||||
username: "opentenbase",
|
||||
password: "secret",
|
||||
database: "postgres",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the OpenTenBase profile for standard PostgreSQL URLs", () => {
|
||||
const parsed = parseConnectionUrl("postgresql://cn.example.com:15432/postgres", "opentenbase");
|
||||
|
||||
expect(parsed.dbType).toBe("postgres");
|
||||
expect(parsed.driverProfile).toBe("opentenbase");
|
||||
expect(parsed.driverLabel).toBe("OpenTenBase");
|
||||
expect(parsed.port).toBe(15432);
|
||||
});
|
||||
|
||||
it("exposes OpenTenBase to connection deep links", () => {
|
||||
expect(connectionProfileForScheme("opentenbase")).toEqual({
|
||||
type: "postgres",
|
||||
profile: "opentenbase",
|
||||
label: "OpenTenBase",
|
||||
defaultPort: 11000,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -140,3 +140,36 @@ describe("DBeaver Cloudberry import", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("DBeaver OpenTenBase import", () => {
|
||||
it("preserves OpenTenBase while reusing the PostgreSQL backend", async () => {
|
||||
const connections = await parseDbeaverConnections(
|
||||
payload({
|
||||
connections: {
|
||||
opentenbase: {
|
||||
id: "opentenbase",
|
||||
name: "distributed-postgres",
|
||||
provider: "opentenbase",
|
||||
driver: "opentenbase-postgresql",
|
||||
configuration: {
|
||||
host: "cn.example.com",
|
||||
port: 11000,
|
||||
database: "postgres",
|
||||
user: "opentenbase",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(connections[0]).toMatchObject({
|
||||
db_type: "postgres",
|
||||
driver_profile: "opentenbase",
|
||||
driver_label: "OpenTenBase",
|
||||
host: "cn.example.com",
|
||||
port: 11000,
|
||||
database: "postgres",
|
||||
username: "opentenbase",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user