Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

1019 B
Raw Blame
import assert from "node:assert/strict";
import { test } from "vitest";

import { detectMqUiAuthKind, isMqAuthKindAllowedForSystem } from "../../apps/desktop/src/lib/connection/mqAuth.ts";

test("keeps hydrated Kafka Kerberos auth allowed during edit", () => {
  const authKind = detectMqUiAuthKind({
    systemKind: "kafka",
    authKind: "none",
    saslMechanism: "GSSAPI",
    jaasConfig: 'com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true keyTab="/etc/user.keytab" principal="[email protected]";',
  });

  assert.equal(authKind, "kerberos");
  assert.equal(isMqAuthKindAllowedForSystem("kafka", authKind), true);
});

test("normalizes unsupported Kafka auth kinds to none", () => {
  assert.equal(
    detectMqUiAuthKind({
      systemKind: "kafka",
      authKind: "token",
      saslMechanism: "PLAIN",
      jaasConfig: "",
    }),
    "none",
  );
});

test("does not allow Kerberos auth outside Kafka", () => {
  assert.equal(isMqAuthKindAllowedForSystem("pulsar", "kerberos"), false);
});