pgTAP examples

Bug #1194246 reported by Jason Etheridge on 2013-06-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Wishlist
Unassigned

Bug Description

collab/phasefx/pgtap @ working/Evergreen.git
http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/phasefx/pgtap

No make target for these yet. We'll want a different target than 'check'

commit 989581ee9e4bdbbdd715325ba63de863740ea769 (HEAD, working-eg/collab/phasefx/pgtap, pgtap)
Author: Jason Etheridge <email address hidden>
Date: Mon Jun 24 15:36:10 2013 -0400

    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 <email address hidden>

Galen Charlton (gmc) wrote :

I've merged the patches that were in collab/gmcharlt/pgtap into collab/phasefx/pgtap.

Jason Etheridge (phasefx) wrote :

I had put an example of checking after an upgrade script, 0799, but thinking about it, that might be a bad thing to promote, at least in that form. We're going to have to tweak and refactor tests as time goes on, but we don't have to go out of our way to invite it. Thinking about how upgrade scripts tend to supersede each other.

Jason Etheridge (phasefx) wrote :

I've been doing some work in collab/phasefx/pgtap_generator that I plan to squash down and cherry-pick into collab/phasefx/pgtap when I'm a bit father along. It adds a script, make-pgtap-tests.pl, with the idea that once the dev community has bought into the idea of maintaining pgTAP tests we can use that script to create a baseline set of schema tests that we can then commit to master and from then on modify whenever we create database upgrade scripts (before or after).

Any thoughts, comments, etc. on this? Right now the generated tests look like this:
http://nox.esilibrary.com/~jason/qa/make-pgtap-tests.pl.pg.2013-07-24.txt

and the output looks like this if ran directly in psql:
http://nox.esilibrary.com/~jason/qa/make-pgtap-tests.pl.pg.2013-07-24.out.txt

Or with pg_prove:

opensrf@dev141:~/git/Evergreen/Open-ILS/src/sql/Pg (pgtap)$ pg_prove -d evergreen2 test.pg
test.pg .. ok
All tests successful.
Files=1, Tests=12118, 44 wallclock secs ( 1.72 usr 0.23 sys + 0.66 cusr 0.82 csys = 3.43 CPU)
Result: PASS

Ben Shum (bshum) on 2013-07-25
Changed in evergreen:
assignee: nobody → Jason Etheridge (phasefx)
status: New → In Progress
importance: Undecided → Wishlist
tags: added: qaproject
Jason Etheridge (phasefx) wrote :

I'm going to go ahead and add a pullrequest for the collab/phasefx/pgtap branch. When I have more examples and a more fleshed out generator script, I'll do a separate ticket for those. In the meantime, having some pgTAP examples in master will help me with QA as I can point other tools (like eg_wheezy_installer.sh) to master or more simply derived branches.

tags: added: pullrequest
Changed in evergreen:
assignee: Jason Etheridge (phasefx) → nobody
status: In Progress → New
Ben Shum (bshum) on 2013-07-25
Changed in evergreen:
status: New → Triaged
Mike Rylander (mrylander) wrote :

Moar testing! Thanks, Jason and Galen!

Changed in evergreen:
status: Triaged → Fix Committed
Galen Charlton (gmc) on 2014-11-13
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers