postgrespro/testgres

Run node.psql in a different port

Closed this issue · 5 comments

Now with #234 that make PostgresNode::port read-only is not possible to run PostgresNode::psql in a different port. We did this trick here in order to do some sanity checks after execute pg_upgrade to compare psql outputs but we should guarantee to use the same psql version (newest) over the new and old cluster to make sure the test output will be the same (psql output can change over major postgres versions).

Are there a workaround for it?

Hello

PostgresNode::psql method works with the own Postgres instance (host name + port number), not with another one.

If you want to use an old psql utility to work with the new (another) Postgres instance - it requires another class, not PostgresNode.

It is not a diffucult to create it over the current testgres infrastructure. Just copy PostgresNode::psql method to another class and append the pair of new arguments - host and port. 5 min of works.

I think, here is needed to create a new class (PostgresUtilities?) with static methods those will call PostgreSQL utilities - psql and others.

Another way - we can add the new arguments 'host' and 'port' with default values to PostgresNode.psql

If they are not defined we will use host/port of this PostgresNode object.

Hello @fabriziomello,

Please see PR #242.

I think, it must solve your problem completely.

Hello @fabriziomello,

Please see PR #242.

I think, it must solve your problem completely.

Thank you very much. It will help a lot!