-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft: add Postgres.js integration tests to the tree
- Loading branch information
Showing
12 changed files
with
3,026 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "supavisor-integration", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"type": "module", | ||
"license": "MIT", | ||
"scripts": { | ||
"test:postgres": "node ./postgres/index.js" | ||
}, | ||
"dependencies": { | ||
"postgres": "^3.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { spawnSync } from 'child_process' | ||
|
||
//exec('dropdb', ['postgres_js_test']) | ||
|
||
//exec('psql', ['-c', 'alter system set ssl=on']) | ||
//exec('psql', ['-c', 'drop user postgres_js_test']) | ||
//exec('psql', ['-c', 'create user postgres_js_test']) | ||
//exec('psql', ['-c', 'alter system set password_encryption=md5']) | ||
//exec('psql', ['-c', 'select pg_reload_conf()']) | ||
//exec('psql', ['-c', 'drop user if exists postgres_js_test_md5']) | ||
//exec('psql', ['-c', 'create user postgres_js_test_md5 with password \'postgres_js_test_md5\'']) | ||
//exec('psql', ['-c', 'alter system set password_encryption=\'scram-sha-256\'']) | ||
//exec('psql', ['-c', 'select pg_reload_conf()']) | ||
//exec('psql', ['-c', 'drop user if exists postgres_js_test_scram']) | ||
//exec('psql', ['-c', 'create user postgres_js_test_scram with password \'postgres_js_test_scram\'']) | ||
// | ||
//exec('createdb', ['postgres_js_test']) | ||
//exec('psql', ['-c', 'grant all on database postgres_js_test to postgres_js_test']) | ||
//exec('psql', ['-c', 'alter database postgres_js_test owner to postgres_js_test']) | ||
|
||
exec('psql', ['-c', 'drop table test']) | ||
|
||
export function exec(cmd, args) { | ||
const { stderr } = spawnSync(cmd, args, { stdio: 'pipe', encoding: 'utf8' }) | ||
if (stderr && !stderr.includes('already exists') && !stderr.includes('does not exist')) | ||
throw stderr | ||
} | ||
|
||
async function execAsync(cmd, args) { // eslint-disable-line | ||
let stderr = '' | ||
const cp = await spawn(cmd, args, { stdio: 'pipe', encoding: 'utf8' }) // eslint-disable-line | ||
cp.stderr.on('data', x => stderr += x) | ||
await new Promise(x => cp.on('exit', x)) | ||
if (stderr && !stderr.includes('already exists') && !stderr.includes('does not exist')) | ||
throw new Error(stderr) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 2 3 | ||
4 5 6 |
Oops, something went wrong.