1
1
import { $ , randomUUIDv7 , sql , SQL } from "bun" ;
2
- import { afterAll , beforeAll , describe , expect , mock , test } from "bun:test" ;
2
+ import { afterAll , describe , expect , mock , test } from "bun:test" ;
3
3
import { bunEnv , bunExe , isCI , isDockerEnabled , tempDirWithFiles } from "harness" ;
4
4
import * as net from "node:net" ;
5
5
import path from "path" ;
@@ -18,7 +18,7 @@ import * as dockerCompose from "../../docker/index.ts";
18
18
import { UnixDomainSocketProxy } from "../../unix-domain-socket-proxy.ts" ;
19
19
20
20
if ( isDockerEnabled ( ) ) {
21
- describe ( "PostgreSQL tests" , ( ) => {
21
+ describe ( "PostgreSQL tests" , async ( ) => {
22
22
let container : { port : number ; host : string } ;
23
23
let socketProxy : UnixDomainSocketProxy ;
24
24
let login : Bun . SQL . PostgresOrMySQLOptions ;
@@ -27,55 +27,53 @@ if (isDockerEnabled()) {
27
27
let login_scram : Bun . SQL . PostgresOrMySQLOptions ;
28
28
let options : Bun . SQL . PostgresOrMySQLOptions ;
29
29
30
- beforeAll ( async ( ) => {
31
- const info = await dockerCompose . ensure ( "postgres_plain" ) ;
32
- console . log ( "PostgreSQL container ready at:" , info . host + ":" + info . ports [ 5432 ] ) ;
33
- container = {
34
- port : info . ports [ 5432 ] ,
35
- host : info . host ,
36
- } ;
37
- process . env . DATABASE_URL = `postgres://bun_sql_test@${ container . host } :${ container . port } /bun_sql_test` ;
38
-
39
- // Create Unix socket proxy for PostgreSQL
40
- socketProxy = await UnixDomainSocketProxy . create ( "PostgreSQL" , container . host , container . port ) ;
41
-
42
- login = {
43
- username : "bun_sql_test" ,
44
- host : container . host ,
45
- port : container . port ,
46
- path : socketProxy . path ,
47
- } ;
48
-
49
- login_domain_socket = {
50
- username : "bun_sql_test" ,
51
- host : container . host ,
52
- port : container . port ,
53
- path : socketProxy . path ,
54
- } ;
55
-
56
- login_md5 = {
57
- username : "bun_sql_test_md5" ,
58
- password : "bun_sql_test_md5" ,
59
- host : container . host ,
60
- port : container . port ,
61
- } ;
62
-
63
- login_scram = {
64
- username : "bun_sql_test_scram" ,
65
- password : "bun_sql_test_scram" ,
66
- host : container . host ,
67
- port : container . port ,
68
- } ;
69
-
70
- options = {
71
- db : "bun_sql_test" ,
72
- username : login . username ,
73
- password : login . password ,
74
- host : container . host ,
75
- port : container . port ,
76
- max : 1 ,
77
- } ;
78
- } ) ;
30
+ const info = await dockerCompose . ensure ( "postgres_plain" ) ;
31
+ console . log ( "PostgreSQL container ready at:" , info . host + ":" + info . ports [ 5432 ] ) ;
32
+ container = {
33
+ port : info . ports [ 5432 ] ,
34
+ host : info . host ,
35
+ } ;
36
+ process . env . DATABASE_URL = `postgres://bun_sql_test@${ container . host } :${ container . port } /bun_sql_test` ;
37
+
38
+ // Create Unix socket proxy for PostgreSQL
39
+ socketProxy = await UnixDomainSocketProxy . create ( "PostgreSQL" , container . host , container . port ) ;
40
+
41
+ login = {
42
+ username : "bun_sql_test" ,
43
+ host : container . host ,
44
+ port : container . port ,
45
+ path : socketProxy . path ,
46
+ } ;
47
+
48
+ login_domain_socket = {
49
+ username : "bun_sql_test" ,
50
+ host : container . host ,
51
+ port : container . port ,
52
+ path : socketProxy . path ,
53
+ } ;
54
+
55
+ login_md5 = {
56
+ username : "bun_sql_test_md5" ,
57
+ password : "bun_sql_test_md5" ,
58
+ host : container . host ,
59
+ port : container . port ,
60
+ } ;
61
+
62
+ login_scram = {
63
+ username : "bun_sql_test_scram" ,
64
+ password : "bun_sql_test_scram" ,
65
+ host : container . host ,
66
+ port : container . port ,
67
+ } ;
68
+
69
+ options = {
70
+ db : "bun_sql_test" ,
71
+ username : login . username ,
72
+ password : login . password ,
73
+ host : container . host ,
74
+ port : container . port ,
75
+ max : 1 ,
76
+ } ;
79
77
80
78
afterAll ( async ( ) => {
81
79
// Containers persist - managed by docker-compose
0 commit comments