make installcheck - connect as different user?

4 views
Skip to first unread message

Matt DeLuco

unread,
Sep 6, 2025, 10:22:40 PMSep 6
to pgTAP Users
Hello again!

Is there any means of specifying a Postgres user to pass along to the installcheck target?

I'm building a Docker image and it's convenient to just run everything as root including the installation of pgtap. However make installcheck fails because there is no "root" user in my instance of Postgres - can I pass a different username e.g. "postgres" to installcheck? (Auth is set to trust.)

I had a poke around in the Makefile and some scripts in the tools/ subdir, but nothing stood out to me.

Thanks!

Matt

David E. Wheeler

unread,
Sep 7, 2025, 8:40:39 AMSep 7
to Matt DeLuco, pgTAP Users
On Sep 6, 2025, at 22:22, 'Matt DeLuco' via pgTAP Users <pgtap...@googlegroups.com> wrote:

> Is there any means of specifying a Postgres user to pass along to the installcheck target?

Yes, pgTAP supports all of the usual libpq environment variables, including PGUSER. The test workflow takes advantage of this feature:

https://github.com/theory/pgtap/blob/5b0daf5922b2991ff83bbf5ba68c678eae71a408/.github/workflows/test.yml#L35

> I'm building a Docker image and it's convenient to just run everything as root including the installation of pgtap. However make installcheck fails because there is no "root" user in my instance of Postgres - can I pass a different username e.g. "postgres" to installcheck? (Auth is set to trust.)

You cannot start Postgres as root, so that user is not available to you. What Postgres image are you basing it on?

Best,

David

signature.asc

Matt DeLuco

unread,
Sep 11, 2025, 1:55:53 PMSep 11
to pgTAP Users
I'm using apt.postgresql.org.sh from postgres-common - inspired by your work (I think) on the pgxn-tools image.

root isn't starting Postgres on the container, but it is building pgTAP.

I'll give $PGUSER a try - thank you David!

Matt

Matt DeLuco

unread,
Sep 11, 2025, 2:15:08 PMSep 11
to pgTAP Users
I just realized - I don't think I can run installcheck on the image build because it requires a running instance. But I save apt.postgresql.org.sh for installing and running a specific Postgres version when running the container.

David E. Wheeler

unread,
Sep 12, 2025, 8:36:48 AMSep 12
to Matt DeLuco, pgTAP Users
On Sep 11, 2025, at 14:15, 'Matt DeLuco' via pgTAP Users <pgtap...@googlegroups.com> wrote:

> I just realized - I don't think I can run installcheck on the image build because it requires a running instance. But I save apt.postgresql.org.sh for installing and running a specific Postgres version when running the container.

Have you considered using the pgxn tools Docker image?

https://hub.docker.com/r/pgxn/pgxn-tools

Best,

David

signature.asc

Matt DeLuco

unread,
Sep 12, 2025, 12:32:16 PMSep 12
to David E. Wheeler, pgTAP Users
Yes, I actually started with pgxn-tools but something didn't work for me. Very likely there was something I didn't understand because I looked at early in the process of trying to figure things out.

I will revisit - thank you David!

Matt

> On Sep 12, 2025, at 08:36, David E. Wheeler <da...@justatheory.com> wrote:
> <signature.asc>

Austin Ziegler

unread,
Sep 12, 2025, 1:07:30 PMSep 12
to Matt DeLuco, pgTAP Users
Hi, Matt

I stopped maintaining a fairly *comprehensive* sqitch+pgtap image back in February:


This loads/unloads pgtap during test execution rather than installing it permanently.

-a

--
You received this message because you are subscribed to the Google Groups "pgTAP Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgtap-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pgtap-users/eeb2e8f2-b011-4dbc-ade8-2354cd7e85b5n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages