]> git.evergreen-ils.org Git - Evergreen.git/commit
pgTAP examples
authorJason Etheridge <jason@esilibrary.com>
Mon, 24 Jun 2013 19:36:10 +0000 (15:36 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 1 Aug 2013 15:33:52 +0000 (11:33 -0400)
commitc36c86e4bf1e8be3a613a267e7462ff3c080c45d
treede06cb5302f23728f3b6eec3cb64d36ea52761d5
parent33b6b485aff2b89312b9f6c3cb7f39e4857e2551
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>
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]