Skip to content

Commit

Permalink
Add gel as a valid dsn scheme. (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark authored Nov 29, 2024
1 parent df92d83 commit 585d012
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/driver/src/conUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,10 @@ async function parseDSNIntoConfig(
throw new InterfaceError(`invalid DSN or instance name: '${_dsnString}'`);
}

if (parsed.protocol !== "edgedb:") {
if (parsed.protocol !== "edgedb:" && parsed.protocol !== "gel:") {
throw new InterfaceError(
`invalid DSN: scheme is expected to be ` +
`'edgedb', got '${parsed.protocol.slice(0, -1)}'`,
`'gel', got '${parsed.protocol.slice(0, -1)}'`,
);
}

Expand Down
14 changes: 10 additions & 4 deletions packages/driver/test/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getServerCommand,
getWSLPath,
startServer,
ConnectConfig,
} from "./testUtil";

export default async () => {
Expand All @@ -18,15 +19,20 @@ export default async () => {
console.log(`Starting server...`);
const { proc, config } = await startServer(args, statusFile);

const { client, version } = await connectToServer(config);

const jestConfig: ConnectConfig = {
...config,
user: version.major >= 6 ? "admin" : "edgedb",
};

// @ts-ignore
global.edgedbProc = proc;

process.env._JEST_EDGEDB_CONNECT_CONFIG = JSON.stringify(config);
process.env._JEST_EDGEDB_CONNECT_CONFIG = JSON.stringify(jestConfig);
process.env._JEST_EDGEDB_AVAILABLE_FEATURES =
JSON.stringify(availableFeatures);

const { client, version } = await connectToServer(config);

// @ts-ignore
global.edgedbConn = client;
process.env._JEST_EDGEDB_VERSION = JSON.stringify(version);
Expand All @@ -41,5 +47,5 @@ export default async () => {
JSON.stringify(availableExtensions);

// tslint:disable-next-line
console.log(`EdgeDB test cluster is up [port: ${config.port}]...`);
console.log(`EdgeDB test cluster is up [port: ${jestConfig.port}]...`);
};
2 changes: 1 addition & 1 deletion packages/driver/test/testUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ConnectConfig } from "../src/conUtils";
import { Client, createClient } from "../src/index.node";
import type { EdgeDBVersion } from "./testbase";

export type { EdgeDBVersion };
export type { EdgeDBVersion, ConnectConfig };

interface ServerInfo {
port: number;
Expand Down

0 comments on commit 585d012

Please sign in to comment.