File tree Expand file tree Collapse file tree 4 files changed +17
-18
lines changed
Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ class PostgreSQLCasette {
138138 } ) ;
139139 }
140140
141- async function connect ( ) {
141+ async function startServer ( ) {
142142 return new Promise ( ( _res , _rej ) => {
143143 let done = false ;
144144 const res = ( ...args ) => {
@@ -178,19 +178,18 @@ class PostgreSQLCasette {
178178 } ) ;
179179 }
180180
181- for ( let retries = 5 ; retries > 0 ; retries -- ) {
182- if ( fs . existsSync ( '/var/lib/postgresql/data/postmaster.pid' ) ) {
183- fs . unlinkSync ( '/var/lib/postgresql/data/postmaster.pid' ) ;
184- }
185- try {
186- await connect ( ) ;
187- break ;
188- } catch ( e ) {
189- if ( options . verbose ) {
190- console . error ( e ) ;
181+ if ( ! fs . existsSync ( '/var/run/postgresql/.s.PGSQL.5432' ) ) {
182+ for ( let retries = 5 ; retries > 0 ; retries -- ) {
183+ try {
184+ await startServer ( ) ;
185+ break ;
186+ } catch ( e ) {
187+ if ( options . verbose ) {
188+ console . error ( e ) ;
189+ }
191190 }
191+ await sleep ( 1000 ) ;
192192 }
193- await sleep ( 1000 ) ;
194193 }
195194
196195 for ( let retries = 20 ; retries > 0 ; retries -- ) {
@@ -407,8 +406,8 @@ class Connection {
407406 /**
408407 * Explicitly close the connection
409408 */
410- close ( ) {
411- return this . _conn . destroy ( ) ;
409+ async close ( ) {
410+ await this . _conn . destroy ( ) ;
412411 }
413412
414413 /**
Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ class TestRunner {
379379 }
380380 }
381381 } finally {
382- conn && conn . close ( ) ;
382+ conn && await conn . close ( ) ;
383383 }
384384 }
385385
Original file line number Diff line number Diff line change 11{
22 "name" : " track-db-test-library" ,
3- "version" : " 2.4 .0" ,
3+ "version" : " 2.5 .0" ,
44 "description" : " Test utility for Track database challenges" ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments