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 { test } from "vitest";
import assert from "node:assert/strict";
import { applyHiveKerberosSubmitConfig, hiveKerberosFormConfig } from "../../apps/desktop/src/lib/database/hiveKerberosOptions.ts";
test("adds Hive Kerberos URL and JVM options while preserving unrelated params", () => {
const result = applyHiveKerberosSubmitConfig({
authMode: "kerberos",
principal: "hive/[email protected]",
krb5ConfPath: "C:\\ProgramData\\MIT\\Kerberos5\\krb5.ini",
jaasConfigPath: "C:\\dbx\\hive-jaas.conf",
useSubjectCredsOnlyFalse: true,
extraJavaOptions: "-Dsun.security.krb5.debug=true",
urlParams: ";serviceDiscoveryMode=zooKeeper;principal=hive/[email protected]",
});
assert.equal(result.urlParams, "serviceDiscoveryMode=zooKeeper;principal=hive/[email protected]");
assert.deepEqual(result.agentJavaOptions, ["-Djava.security.krb5.conf=C:\\ProgramData\\MIT\\Kerberos5\\krb5.ini", "-Djava.security.auth.login.config=C:\\dbx\\hive-jaas.conf", "-Djavax.security.auth.useSubjectCredsOnly=false", "-Dsun.security.krb5.debug=true"]);
});
test("disabling Hive Kerberos removes generated URL params but keeps extra JVM options", () => {
const result = applyHiveKerberosSubmitConfig({
authMode: "none",
principal: "hive/[email protected]",
krb5ConfPath: "/etc/krb5.conf",
jaasConfigPath: "/etc/hive-jaas.conf",
useSubjectCredsOnlyFalse: true,
extraJavaOptions: "-Dcustom.flag=true",
urlParams: "auth=kerberos;principal=hive/[email protected];transportMode=http",
});
assert.equal(result.urlParams, "transportMode=http");
assert.deepEqual(result.agentJavaOptions, ["-Dcustom.flag=true"]);
});
test("preserves non Kerberos Hive auth params when Kerberos is disabled", () => {
const result = applyHiveKerberosSubmitConfig({
authMode: "none",
principal: "",
krb5ConfPath: "",
jaasConfigPath: "",
useSubjectCredsOnlyFalse: false,
extraJavaOptions: "",
urlParams: "auth=noSasl;transportMode=http",
});
assert.equal(result.urlParams, "auth=noSasl;transportMode=http");
});
test("hydrates Hive Kerberos form values from saved URL and JVM options", () => {
const form = hiveKerberosFormConfig("principal=hive/[email protected]", ["-Djava.security.krb5.conf=/etc/krb5.conf", "-Djava.security.auth.login.config=/etc/hive-jaas.conf", "-Djavax.security.auth.useSubjectCredsOnly=false", "-Dsun.security.krb5.debug=true"]);
assert.deepEqual(form, {
authMode: "kerberos",
principal: "hive/[email protected]",
krb5ConfPath: "/etc/krb5.conf",
jaasConfigPath: "/etc/hive-jaas.conf",
useSubjectCredsOnlyFalse: true,
extraJavaOptions: "-Dsun.security.krb5.debug=true",
});
});