pgTAP examples
authorJason Etheridge <jason@esilibrary.com>
Mon, 24 Jun 2013 19:36:10 +0000 (15:36 -0400)
committerJason Etheridge <jason@esilibrary.com>
Mon, 24 Jun 2013 19:48:10 +0000 (15:48 -0400)
commit989581ee9e4bdbbdd715325ba63de863740ea769
treed91ef38e551ac036ad017002878aadd1bdddbfbb
parent79eb7d97debfa8e4292f3f3170fe862ddd09f8ca
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>
Open-ILS/src/sql/Pg/t/0799.state_field_required_toggle.s [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/README [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/dewey.s [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/schema.s [new file with mode: 0644]
Open-ILS/src/sql/Pg/t/versions.s [new file with mode: 0644]