theory / tap-parser-sourcehandler-pgtap

TAP::Parser::SourceHandler::pgTAP
http://search.cpan.org/dist/TAP::Parser::SourceHandler::pgTAP
11 stars 13 forks source link

failed: No such file or directory at #24

Closed xenoterracide closed 3 years ago

xenoterracide commented 4 years ago

this error is a bit misleading

Calebs-MBP:service-db-main-migration calebcushing$ docker run -v $PWD/src/test/resources/pgtap:/t -ePGPASSWORD:DontUseThisPassword xenoterracide/pg_prove:latest ls -1 /t
can-connect.sql
Calebs-MBP:service-db-main-migration calebcushing$ docker run -v $PWD/src/test/resources/pgtap:/t -ePGPASSWORD:DontUseThisPassword xenoterracide/pg_prove:latest pg_prove --host localhost --dbname briggo_production --ext .sql --recurse /t
Could not execute (psql --no-psqlrc --no-align --quiet --pset pager=off --pset tuples_only=true --set ON_ERROR_STOP=1 --host localhost --dbname briggo_production --file /t/can-connect.sql): open3: exec of psql --no-psqlrc --no-align --quiet --pset pager=off --pset tuples_only=true --set ON_ERROR_STOP=1 --host localhost --dbname briggo_production --file /t/can-connect.sql failed: No such file or directory at /usr/local/lib/perl5/5.30.2/TAP/Parser/Iterator/Process.pm line 165.

trying to run the command makes it a bit more obvious, perhaps check for psql?

docker run -v $PWD/src/test/resources/pgtap:/t -ePGPASSWORD:DontUseThisPassword xenoterracide/pg_prove:latest psql --no-psqlrc --no-align --quiet --pset pager=off --pset tuples_only=true --set ON_ERROR_STOP=1 --host localhost --dbname briggo_production --file /t/can-connect.sql
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"psql\": executable file not found in $PATH": unknown.
theory commented 4 years ago

This is the error from Perl. It says No such file or directory, meaning psql. That is Perl checking for the existence of the file.

xenoterracide commented 4 years ago

I get that this is the default error from perl, what I'm suggesting is checking to see if psql exists before running it with exec, and then throwing a nicer error (also the documentation doesn't mention psql must be installed in the installation steps)

theory commented 3 years ago

Well that's handled by TAP::Parser::Iterator::Process; you might suggest nicer error handling there, though I suspect they think it's clear enough as-is (it tells you the file doesn't exist).