Add pg_clients test for serverless driver (#3827)

Fixes #3819
This commit is contained in:
Arthur Petukhovsky
2023-03-15 16:18:38 +03:00
committed by GitHub
parent 10a5d36af8
commit cd17802b1f
8 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
# pg_clients
To run a single test locally:
```bash
export BENCHMARK_CONNSTR=postgres://user:pass@ep-abc-xyz-123.us-east-2.aws.neon.build/neondb
# will filter only tests with "serverless" in the name
./scripts/pytest -m remote_cluster -k serverless
```

View File

@@ -22,6 +22,7 @@ from fixtures.utils import subprocess_capture
),
"swift/PostgresNIOExample",
"typescript/postgresql-client",
"typescript/serverless-driver",
],
)
def test_pg_clients(test_output_dir: Path, remote_pg: RemotePostgres, client: str):

View File

@@ -0,0 +1 @@
node_modules/

View File

@@ -0,0 +1 @@
node_modules/

View File

@@ -0,0 +1,7 @@
FROM node:18
WORKDIR /source
COPY . .
RUN npm clean-install
CMD ["/source/index.js"]

View File

@@ -0,0 +1,20 @@
#! /usr/bin/env node
import { Client } from '@neondatabase/serverless'
(async () => {
const client = new Client({
host: process.env.NEON_HOST,
database: process.env.NEON_DATABASE,
user: process.env.NEON_USER,
password: process.env.NEON_PASSWORD,
});
client.connect();
const result = await client.query({
text: 'select 1',
rowMode: 'array',
});
const rows = result.rows;
await client.end();
console.log(rows[0][0]);
})()

View File

@@ -0,0 +1,51 @@
{
"name": "serverless-driver",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"@neondatabase/serverless": "^0.2.8",
"ws": "^8.13.0"
}
},
"node_modules/@neondatabase/serverless": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-0.2.8.tgz",
"integrity": "sha512-+yWjIOJsFnrtt2xvtLVEzWM2lfvemawk/DBg4mD2cZOF/IC6Jn4wEctZyk60TscZMSxfozNkPoxmZvBmNuQ0vA=="
},
"node_modules/ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
},
"dependencies": {
"@neondatabase/serverless": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-0.2.8.tgz",
"integrity": "sha512-+yWjIOJsFnrtt2xvtLVEzWM2lfvemawk/DBg4mD2cZOF/IC6Jn4wEctZyk60TscZMSxfozNkPoxmZvBmNuQ0vA=="
},
"ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"requires": {}
}
}
}

View File

@@ -0,0 +1,7 @@
{
"type": "module",
"dependencies": {
"@neondatabase/serverless": "^0.2.8",
"ws": "^8.13.0"
}
}