MCPcopy Create free account
hub / github.com/bytebase/bytebase / getInstancePgPort

Function getInstancePgPort

frontend/tests/e2e/framework/psql.ts:8–17  ·  view source on GitHub ↗
(
  env: TestEnv & { api: BytebaseApiClient },
)

Source from the content-addressed store, hash-verified

6// source from the API. Avoids hardcoding PORT+3 / PORT+4 offsets which would
7// break if discovery picks the "test" sample instance instead of "prod".
8export async function getInstancePgPort(
9 env: TestEnv & { api: BytebaseApiClient },
10): Promise<string> {
11 const instance = await env.api.getInstance(env.instance);
12 const port = instance.dataSources?.[0]?.port;
13 if (!port) {
14 throw new Error(`Instance ${env.instance} has no data source port`);
15 }
16 return port;
17}
18
19// Execute SQL via psql over the Unix socket on the sample Postgres instance.
20// Used for DDL/DML setup and teardown — Bytebase's query API is read-only.

Calls 1

getInstanceMethod · 0.80

Tested by 2

createMaskingTestDataFunction · 0.72
dropMaskingTestDataFunction · 0.72