Install issues with create extensions and installcheck

475 views
Skip to first unread message

JedW ICD

unread,
Sep 30, 2021, 6:50:45 PM9/30/21
to pgTAP Users
I'm trying to install. I'm working with a WSL Ubuntu environment and have a PG12 docker running.

I've done:
make
sudo make install
sudo cpan TAP::Parser::SourceHandler::pgTAP
  would you like ... automatically?  yes

cd sql
psql -h0.0.0.0 -p5432 -d icd -U postgres -f pgtap.sql

Here are the errors I'm getting:
create extension pg_tap;
   ERROR:  could not open extension control file "/usr/share/postgresql/12/extension/pgtap.control": No such file or directory

seems obvious but the file is there and readable:
DESKTOP-CP2PQSJ:sql> ll /usr/share/postgresql/12/extension/pgtap.control
-rw-r--r-- 1 root root 176 Sep 30 08:20 /usr/share/postgresql/12/extension/pgtap.control
DESKTOP-CP2PQSJ:sql> head -1 /usr/share/postgresql/12/extension/pgtap.control
# pgTAP extension

I also tried:
sudo make installcheck PGHOST=0.0.0.0 PGUSER=postgres

no errors until the running regression test queries and all fail with:
FAILED (test process exited with exit code 3)

in the output file each test section shows ~

+ERROR:  function plan(integer) does not exist
+LINE 1: SELECT plan(24);
+               ^
+HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
diff -U3 /home/jwalker/stage/pgtap/pgtap-1.1.0/test/expected/do_tap.out /home/jwalker/stage/pgtap/pgtap-1.1.0/results/do_tap.out
--- /home/jwalker/stage/pgtap/pgtap-1.1.0/test/expected/do_tap.out      2019-11-25 12:03:44.000000000 -0700
+++ /home/jwalker/stage/pgtap/pgtap-1.1.0/results/do_tap.out    2021-09-30 08:52:41.704018800 -0600


I'm feeling pretty stuck.




JedW ICD

unread,
Sep 30, 2021, 6:53:35 PM9/30/21
to pgTAP Users
oops, forgot, I've got pgtap-1.1.0.zip

David E. Wheeler

unread,
Oct 1, 2021, 10:55:08 AM10/1/21
to JedW ICD, pgTAP Users
On Sep 30, 2021, at 6:50 PM, JedW ICD <jed.w...@icd-tech.com> wrote:

> I'm trying to install. I'm working with a WSL Ubuntu environment and have a PG12 docker running.

You need to download pgTAP and build it inside the container itself. Is that what you’re doing?

Best,

David

JedW ICD

unread,
Oct 1, 2021, 11:44:18 AM10/1/21
to pgTAP Users
David,
Geez, that makes sense. I'm new to containers too. I'll have to see how to do that. 
It would sure be nice if they had that mentioned in the Install instructions.

I'll figure that out and I'll bet it will be good.
Thank you!! :)

David E. Wheeler

unread,
Oct 1, 2021, 12:02:45 PM10/1/21
to JedW ICD, pgTAP Users
On Oct 1, 2021, at 11:44 AM, JedW ICD <jed.w...@icd-tech.com> wrote:

> Geez, that makes sense. I'm new to containers too. I'll have to see how to do that.
> It would sure be nice if they had that mentioned in the Install instructions.

Who? Which install instructions?

You can do it two ways:

1. Create your container and SSH into it, then do the install directly there.

2. Create a Dockerfile that does the same thing, but results in an image you can use that image.

For an example of the second one, Dalibo has created a Dockerfile that installs pgTAP on a Postgres image:

https://hub.docker.com/r/dalibo/pgtap
https://github.com/dalibo/docker-pgtap/blob/master/Dockerfile

HTH,

David

JedW ICD

unread,
Oct 1, 2021, 12:08:51 PM10/1/21
to pgTAP Users
https://pgxn.org/dist/pgtap/    They mention a fit gotchas in it, this would be a good one to mention. Being new to docker and pgtap I had no idea what these errors indicated.  A quick note about "if you're using PostgreSQL in a Docker container..."

I'm going to try SSH into the container to install. This would be nice as I don't need it every time I rebuild, just when I'm ready to do unit tests. then I don't have to update the container if I have a new version of pgtap, e.g.
I'll look into those docker images, thank you.

JedW ICD

unread,
Oct 6, 2021, 5:31:30 PM10/6/21
to pgTAP Users
FYI - this work got pushed. I will reply with results when i get back to it.
In the meantime David, I did create ticket for the install doc to cover this: https://github.com/theory/pgtap/issues/275

David E. Wheeler

unread,
Oct 6, 2021, 6:25:53 PM10/6/21
to JedW ICD, pgTAP Users

On Oct 6, 2021, at 17:31, JedW ICD <jed.w...@icd-tech.com> wrote:

> In the meantime David, I did create ticket for the install doc to cover this: https://github.com/theory/pgtap/issues/275

Much appreciated!

David

signature.asc

JedW ICD

unread,
Nov 11, 2021, 3:25:09 PM11/11/21
to pgTAP Users
I've now installed pgtap inside the container for the postgresql database and am getting the following errors, 
running make installcheck
  make: *** No rule to make target 'installcheck'. Stop.

If I run 

  psql -h0.0.0.0 -p5432 -d icd -U postgres -f pgtap.sql
I get a lot of 
  ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists


JedW ICD

unread,
Nov 11, 2021, 3:26:59 PM11/11/21
to pgTAP Users
forgot to mention, /usr/lib/postgresql/12/lib/plpgsql.so does exists with -rw-r--r--. installed as root and i'm running this root. 

David E. Wheeler

unread,
Nov 11, 2021, 3:40:58 PM11/11/21
to JedW ICD, pgTAP Users
On Nov 11, 2021, at 3:25 PM, JedW ICD <jed.w...@icd-tech.com> wrote:

> I've now installed pgtap inside the container for the postgresql database and am getting the following errors,
> running make installcheck
> make: *** No rule to make target 'installcheck'. Stop.

Please send the complete list of command you’re running, and where (inside the container or out, or in a Dockerfile). That should help us better help you.

Best,

David

JedW ICD

unread,
Nov 11, 2021, 3:52:30 PM11/11/21
to pgTAP Users
I hope this is enough and I'm not just doing something stupid. Thank you!


Dockerfile
docker-compose.yml
version: '3.3'
services:
  postgres:
    image: "postgres:12.4"
    volumes:
    - postgres:/var/lib/postgresql/data
    ports:
     - "5432:5432"
    environment:
     - POSTGRES_PASSWORD=postgres
     - POSTGRES_USER=postgres
     - POSTGRES_DB=icd
volumes:
  postgres:
    driver: local

pre-install for docker:
 sudo docker ps
 export CONTAINER=<containername from above>
  e.g. export CONTAINER=docker_postgres_1
 sudo docker exec -it $CONTAINER /bin/sh -c "mkdir /home/pgtap"
 sudo docker cp pgtap-*.zip $CONTAINER:/home/pgtap
 sudo docker exec -it $CONTAINER /bin/sh

install:
 apt-get -y update && \
  apt-get -y upgrade && \
  apt-get -y dist-upgrade && \
  apt-get -y autoremove && \
  apt-get -y clean && \
  apt-get -y install zip && \
  apt-get -y install make && \
  apt-get -y install patch && \
  apt-get -y install vim

 cd /home/pgtap
 unzip pgtap-1.1.0.zip
 cd pgtap-1.1.0

 make
 make install
 cpan TAP::Parser::SourceHandler::pgTAP
  would you like ... automatically?  yes
  should end in   /usr/bin/make install  -- OK
 make installcheck PGUSER=postgres PGHOST=0.0.0.0 PGPORT=5432
   !! breaks here, ...
   make: *** No rule to make target 'installcheck'.  Stop.
   
 cd sql
 psql -h0.0.0.0 -p5432 -d icd -U postgres -f pgtap.sql > pgtap.log 2>&1
   !! breaks here, ...
   < see below, shows some of output >
 grep ERROR pgtap.log
   should not return any
   

# ls -l /usr/lib/postgresql/12/lib/plpgsql.so
-rwxrwxrwx 1 root root 198736 Sep 29 08:43 /usr/lib/postgresql/12/lib/plpgsql.so


 
# psql -h0.0.0.0 -p5432 -d icd -U postgres -f pgtap.sql
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
psql:pgtap.sql:61: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:69: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:79: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:93: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:104: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:114: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:124: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:140: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:145: ERROR:  function _set(text, integer, unknown) does not exist
LINE 3:     SELECT _set($1, $2, '')
                   ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
psql:pgtap.sql:154: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:163: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:168: ERROR:  function _add(text, integer, unknown) does not exist
LINE 3:     SELECT _add($1, $2, '')
                   ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
psql:pgtap.sql:176: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:181: ERROR:  function _get(unknown) does not exist
LINE 3:     SELECT _get('failed');
                   ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
psql:pgtap.sql:223: ERROR:  could not load library "/usr/lib/postgresql/12/lib/plpgsql.so": /usr/lib/postgresql/12/lib/plpgsql.so: undefined symbol: EnsurePortalSnapshotExists
psql:pgtap.sql:233: ERROR:  function _get(unknown) does not exist
LINE 4:         _get('curr_test'),
                ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

... continutes (very long, same exact error)

David E. Wheeler

unread,
Nov 11, 2021, 7:41:07 PM11/11/21
to JedW ICD, pgTAP Users
On Nov 11, 2021, at 3:52 PM, JedW ICD <jed.w...@icd-tech.com> wrote:

> I hope this is enough and I'm not just doing something stupid. Thank you!

The default Postgres container does not have the build tools necessary to build extensions, in this case the postgresql-servrer-dev package. I created https://hub.docker.com/r/pgxn/pgxn-tools to have the right tools (and to allow installation of different versions of Postgres). If you want to be able to build stuff, add these items to your apt-get command:

build-essential clang llvm llvm-dev llvm-runtime postgresql-server-dev

I suggest you also add this one and skip using cpan to install it:

libtap-parser-sourcehandler-pgtap-perl

HTH,

DAvid

Jed Walker

unread,
Dec 1, 2021, 12:54:24 PM12/1/21
to David E. Wheeler, pgTAP Users
I really appreciate how you responsive you are, thank you.

We are going to be running production in Amazon RDS and PostgreSQL DBaaS is not quite PostgreSQL, so I need to be Unit Testing against Amazon. As such we've created a Unit Test database in RDS and fortunately the pgTap extension is built-in!

So far, my trial has been good and my tests are looking good.

Great stuff, and thank you again.


-----Original Message-----
From: pgtap...@googlegroups.com <pgtap...@googlegroups.com> On Behalf Of David E. Wheeler
Sent: Thursday, November 11, 2021 17:41
To: Jed Walker <jed.w...@icd-tech.com>
Cc: pgTAP Users <pgtap...@googlegroups.com>
Subject: Re: [pgtap-users] Install issues with create extensions and installcheck

**EXTERNAL**

On Nov 11, 2021, at 3:52 PM, JedW ICD <jed.w...@icd-tech.com> wrote:

> I hope this is enough and I'm not just doing something stupid. Thank you!

The default Postgres container does not have the build tools necessary to build extensions, in this case the postgresql-servrer-dev package. I created https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinkprotect.cudasvc.com%2Furl%3Fa%3Dhttps%253a%252f%252fhub.docker.com%252fr%252fpgxn%252fpgxn-tools%26c%3DE%2C1%2CI8B5YZAMW1-f1QbH-WRsApWKbluQtWySDdu2j3SBzaIgaO0kG4Qvyz8SJ_sE_VGtF1Brqhjt_kKSMdBN3KaGYJZGgzsUIZiOQ79e0MHYr1u_%26typo%3D1&amp;data=04%7C01%7Cjed.walker%40icd-tech.com%7C33c12b962bbc4fca19c908d9a5751ee6%7Cee3d5ccdf951421a8e1fd14a200c003f%7C0%7C0%7C637722745653417008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=bJiaoB%2FvqqthH9vmYxT0iL3XGxt%2F%2FDT8yxdwHCFQgxo%3D&amp;reserved=0 to have the right tools (and to allow installation of different versions of Postgres). If you want to be able to build stuff, add these items to your apt-get command:

build-essential clang llvm llvm-dev llvm-runtime postgresql-server-dev

I suggest you also add this one and skip using cpan to install it:

libtap-parser-sourcehandler-pgtap-perl

HTH,

DAvid

--
You received this message because you are subscribed to a topic in the Google Groups "pgTAP Users" group.
To unsubscribe from this topic, visit https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinkprotect.cudasvc.com%2Furl%3Fa%3Dhttps%253a%252f%252fgroups.google.com%252fd%252ftopic%252fpgtap-users%252f4rQCm5NAWIc%252funsubscribe.%26c%3DE%2C1%2CYNoBTu--NunVCQMqnIZZwhyiKh0CGmRd4re-XIzV8gRoKtHRATw9b2m3q7u7k3C2lYUuRsgz0iURFQFIKp_03PoujoGOmASQRJ5OQd39hlnWoMPO%26typo%3D1&amp;data=04%7C01%7Cjed.walker%40icd-tech.com%7C33c12b962bbc4fca19c908d9a5751ee6%7Cee3d5ccdf951421a8e1fd14a200c003f%7C0%7C0%7C637722745653426996%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=%2BoAAiWtOyq77J6JlaK%2BM31ZApOg%2ByKkcI6WXrhT2110%3D&amp;reserved=0
To unsubscribe from this group and all its topics, send an email to pgtap-users...@googlegroups.com.
To view this discussion on the web visit https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinkprotect.cudasvc.com%2Furl%3Fa%3Dhttps%253a%252f%252fgroups.google.com%252fd%252fmsgid%252fpgtap-users%252fF6F09BB2-7482-4FEF-A515-2F33FD40D619%2540justatheory.com.%26c%3DE%2C1%2CcrkOpchOxn6zRbKcof6lI6ISYOjQw5TT7ViphKysti3qWyxzmxJGlPdpYbHtV0JaMLil5szoFH1qvGQatzoJsBuX6X2VgWDM1D7S6ZPW%26typo%3D1&amp;data=04%7C01%7Cjed.walker%40icd-tech.com%7C33c12b962bbc4fca19c908d9a5751ee6%7Cee3d5ccdf951421a8e1fd14a200c003f%7C0%7C0%7C637722745653426996%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HxFg81NbTpARtemHCoWRL0i9x4WZisJ4Usp0vVtQZFE%3D&amp;reserved=0

________________________________
[CAUTION] This e-mail originated from outside of ICD. Do not click on links or open attachments unless you trust and have verified the sender. Use the PhishNotify function if you have any doubts.
________________________________

David E. Wheeler

unread,
Dec 1, 2021, 1:33:26 PM12/1/21
to Jed Walker, pgTAP Users
On Dec 1, 2021, at 12:54, Jed Walker <jed.w...@icd-tech.com> wrote:

> I really appreciate how you responsive you are, thank you.
>
> We are going to be running production in Amazon RDS and PostgreSQL DBaaS is not quite PostgreSQL, so I need to be Unit Testing against Amazon. As such we've created a Unit Test database in RDS and fortunately the pgTap extension is built-in!
>
> So far, my trial has been good and my tests are looking good.
>
> Great stuff, and thank you again.

Nice! I think you can thanks Jim Nasby for pgTAP in Amazon Postgres.

D

Reply all
Reply to author
Forward
0 new messages