{"id":14973982,"url":"https://github.com/stephane-klein/poc-postgresql-pgtap","last_synced_at":"2025-10-27T05:31:24.814Z","repository":{"id":99040324,"uuid":"123439562","full_name":"stephane-klein/poc-postgresql-pgTAP","owner":"stephane-klein","description":"This is a POC to test pgTAP (I use Docker image) to write and execute PL/pgSQL - SQL Procedural Language.","archived":false,"fork":false,"pushed_at":"2018-03-01T15:18:18.000Z","size":3,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T02:41:24.440Z","etag":null,"topics":["pgsql","pgtap","poc","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephane-klein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-01T13:37:16.000Z","updated_at":"2022-06-30T18:12:26.000Z","dependencies_parsed_at":"2023-07-20T05:30:51.383Z","dependency_job_id":null,"html_url":"https://github.com/stephane-klein/poc-postgresql-pgTAP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fpoc-postgresql-pgTAP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fpoc-postgresql-pgTAP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fpoc-postgresql-pgTAP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fpoc-postgresql-pgTAP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephane-klein","download_url":"https://codeload.github.com/stephane-klein/poc-postgresql-pgTAP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238445830,"owners_count":19473820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pgsql","pgtap","poc","postgresql"],"created_at":"2024-09-24T13:49:46.776Z","updated_at":"2025-10-27T05:31:19.431Z","avatar_url":"https://github.com/stephane-klein.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a POC to test [pgTAP](http://pgtap.org/) to write and execute\n[PL/pgSQL - SQL Procedural Language](https://www.postgresql.org/docs/current/static/plpgsql.html) tests.\n\nAfter reading this issue [theory/pgtap - Packaged on Alpine](https://github.com/theory/pgtap/issues/139) I have decided to use [LREN-CHUV/docker-pgtap](https://github.com/LREN-CHUV/docker-pgtap) Docker image.\n\nStart and initialize PostgreSQL database with [create.sql](create.sql) file:\n\n```\n$ make init\ndocker-compose up -d postgres\nCreating pocpostgresqlpgtap_postgres_1 ... done\ndocker-compose run wait_postgres\nWaiting for postgres:5432  ...............  up!\nEverything is up\ncat create.sql | docker exec -i --user postgres `docker-compose ps -q postgres` psql db\nDROP FUNCTION\nNOTICE:  function add() does not exist, skipping\nCREATE FUNCTION\n add\n-----\n   3\n(1 row)\n```\n\nThis is a simple test ([test-add.sql](tests/test-add.sql)):\n\n```\nBEGIN;\n  SELECT plan(2);\n  SELECT ok(add(1, 2) = 3, 'add 1 + 2');\n  SELECT ok(add(1, 2) = 4, 'this test must fail');\nROLLBACK;\n```\n\nNow, this is the test execution:\n\n```\n$ make tests\ndocker-compose run --rm db_check\nWaiting for database...\n2018/03/01 13:31:55 Waiting for: tcp://postgres:5432\n2018/03/01 13:31:55 Connected to tcp://postgres:5432\n\nRunning tests: /test/*.sql -v\n/test/test-add.sql ..\n1..2\nok 1 - add 1 + 2\nnot ok 2 - add 1 + 2\n# Failed test 2: \"add 1 + 2\"\nFailed 1/2 subtests\n\nTest Summary Report\n-------------------\n/test/test-add.sql (Wstat: 0 Tests: 2 Failed: 1)\n  Failed test:  2\nFiles=1, Tests=2,  1 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU)\nResult: FAIL\nmake: *** [tests] Error 1\n```\n\nYou can this that the first test success and second test failed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fpoc-postgresql-pgtap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephane-klein%2Fpoc-postgresql-pgtap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fpoc-postgresql-pgtap/lists"}