File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,13 @@ port=5432
77database =postgres
88verbose =false
99
10+ test-connection :
11+ @node script/test-connection.js -u $(user ) --password $(password ) -p $(port ) -d $(database ) -h $(host ) --verbose $(verbose )
12+
1013test-unit :
1114 @find test/unit -name " *-tests.js" | xargs -n 1 -I file node file --verbose $(verbose )
1215
13- test-integration :
16+ test-integration : test-connection
1417 @find test/integration -name " *-tests.js" | xargs -n 1 -I file node file -u $(user ) --password $(password ) -p $(port ) -d $(database ) -h $(host ) --verbose $(verbose )
1518
1619test-all : test-unit test-integration
Original file line number Diff line number Diff line change 1+ var helper = require ( __dirname + '/../test/test-helper' ) ;
2+ var connectionString = helper . connectionString ( ) ;
3+ console . log ( ) ;
4+ console . log ( "testing ability to connect to '%s'" , connectionString ) ;
5+ var pg = require ( __dirname + '/../lib' ) ;
6+ pg . connect ( connectionString , function ( err , client ) {
7+ if ( err !== null ) {
8+ console . error ( "Recieved connection error when attempting to contact PostgreSQL:" ) ;
9+ console . error ( err ) ;
10+ process . exit ( 255 ) ;
11+ }
12+ console . log ( "Checking for existance of required test table 'person'" )
13+ client . query ( "SELECT COUNT(name) FROM person" , function ( err , callback ) {
14+ if ( err != null ) {
15+ console . error ( "Recieved error when executing query 'SELECT COUNT(name) FROM person'" )
16+ console . error ( "It is possible you have not yet run the table create script under script/create-test-tables" )
17+ console . error ( "Consult the postgres-node wiki under the 'Testing' section for more information" )
18+ console . error ( err ) ;
19+ process . exit ( 255 ) ;
20+ }
21+ pg . end ( ) ;
22+ } )
23+ } )
Original file line number Diff line number Diff line change 11var helper = require ( __dirname + '/../test-helper' ) ;
22//export parent helper stuffs
33module . exports = helper ;
4+
5+ if ( helper . args . verbose ) {
6+ }
You can’t perform that action at this time.
0 commit comments