From 585d012d0655f98020bc24c940f6a530cddf5e19 Mon Sep 17 00:00:00 2001 From: dnwpark Date: Fri, 29 Nov 2024 12:19:27 -0500 Subject: [PATCH] Add gel as a valid dsn scheme. (#1134) --- packages/driver/src/conUtils.ts | 4 ++-- packages/driver/test/globalSetup.ts | 14 ++++++++++---- packages/driver/test/testUtil.ts | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/driver/src/conUtils.ts b/packages/driver/src/conUtils.ts index ce3036366..79fae0d4f 100644 --- a/packages/driver/src/conUtils.ts +++ b/packages/driver/src/conUtils.ts @@ -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)}'`, ); } diff --git a/packages/driver/test/globalSetup.ts b/packages/driver/test/globalSetup.ts index 8a05d740b..c36ebd8f0 100644 --- a/packages/driver/test/globalSetup.ts +++ b/packages/driver/test/globalSetup.ts @@ -5,6 +5,7 @@ import { getServerCommand, getWSLPath, startServer, + ConnectConfig, } from "./testUtil"; export default async () => { @@ -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); @@ -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}]...`); }; diff --git a/packages/driver/test/testUtil.ts b/packages/driver/test/testUtil.ts index cbf864545..f19f1d3eb 100644 --- a/packages/driver/test/testUtil.ts +++ b/packages/driver/test/testUtil.ts @@ -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;