pgTAP examples
These specific ones do not assume stock test data such as the concerto bibs, and
I think such tests should go elsewhere. You need to install pgTAP. I did the
following for my test environment:
git clone git://github.com/theory/pgtap.git
cd pgtap
make
make installcheck
sudo make install
Then in my Evergreen database with psql, I did:
CREATE EXTENSION pgtap;
I also installed a CPAN module to get pg_prove:
sudo cpan TAP::Parser::SourceHandler::pgTAP
You can use psql to run a given test like so:
opensrf@dev141:~/git/Evergreen/Open-ILS/src/sql/Pg/t (pgtap)$ psql -d evergreen -f 0799.state_field_required_toggle.s
1..4
ok 1 - actor.usr_address.state does not have the NOT NULL constraint
ok 2 - ui.patron.edit.au.state.require exists
ok 3 - ui.patron.edit.au.state.show exists
ok 4 - ui.patron.edit.au.state.suggest exists
Or you can use pg_prove on all or some of them:
opensrf@dev141:~/git/Evergreen/Open-ILS/src/sql/Pg/t (pgtap)$ pg_prove -d evergreen *.s
0799.state_field_required_toggle.s .. ok
dewey.s ............................. 1/6
# Failed (TODO) test 6: "testing prefix plus decimal"
# 'YR_DVD_800_100000000000000'
# <
# 'YR_000000000000000_DVD_900'
dewey.s ............................. ok
schema.s ............................ ok
versions.s .......................... ok
All tests successful.
Files=4, Tests=39, 0 wallclock secs ( 0.05 usr 0.03 sys + 0.13 cusr 0.07 csys = 0.28 CPU)
Result: PASS
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>