You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a new client tsclient, to handle postgres and pgmoneta operations while running tests in test environment.
Requirements
The infrastructure to perform pgmoneta operations like backup, restore, shutdown and delete are already in place - will keep it as is (port from cli.c)
add a new command - exec-query to tsclient that will take server name and a query as an argument. f.ex
pgmoneta-tscli -c </path/to/pgmoneta.conf> exec-query <server> "<query to execute>"
The <server> argument will tell the host and port to the client and the database will always be postgres and user will be
superuser (the user that executes the client - since it is assumed that the tscli is specifically for running testsuites).
Okay, but how will we manage the initial postgres setup (psql commands), because those commands will have to be executed before testsuite even started.
@jesperpedersen, I was thinking upon it and there are some things that are still not very clear.
No, there is no CLI tool in this.
It is a test suite API that executes the commands, and look at the entire response - especially Outcome of course.\
So, a test suite / case will create a tsclient, execute, get the response and then close it.
as far as I understand from testsuite API, you mean that it is not a separate process (like main, cli, admin etc) but more like a library that we can import in our tests and execute (and its usecase is limited to test directory).
The test suite should use the same configuration that pgmoneta was started with
If we make it a library, how will it be able to get the configuration file paths of the pgmoneta by itself.
Yes, it is just an API that make the calls to the server
Shall I assume default configurations file location in this API?
like build/pgmoneta-testsuite/conf/pgmoneta.conf that we set for main process in the testsuite.sh script.
So in each testcase -
Initialize the tesetsuite API by reading the default configuration files
Make call to the server to execute appropriate command (get server details from config)
Check Outcome if true testcase passed else testcase failed.
I was thinking of initializing the tsclient in runner (not in each testcase) and connect to the main server in the initialisation itself (so that we don’t need a new connection for every testcase), so testcase will only execute APIs on the socket (from initialisation) rather than making a new connection every single time.
Activity
jesperpedersen commentedon Mar 4, 2025
No, there is no CLI tool in this.
It is a test suite API that executes the commands, and look at the entire response - especially
Outcomeof course.\So, a test suite / case will create a tsclient, execute, get the response and then close it.
The test suite should use the same configuration that pgmoneta was started with
jesperpedersen commentedon Mar 4, 2025
It is mostly copy'n'paste from
cli.c- you just need to fail ifOutcome: Status: falsehappensashu3103 commentedon Mar 4, 2025
Okay, but how will we manage the initial postgres setup (psql commands), because those commands will have to be executed before testsuite even started.
jesperpedersen commentedon Mar 4, 2025
Yeah, we can do that in
ci.yamlto start with.Then we can integrate a
system()call intsclient.claterjesperpedersen commentedon Mar 4, 2025
Maybe look at https://github.com/PGBuildFarm/client-code for ideas
ashu3103 commentedon Mar 4, 2025
Kool, I'll get back to you after referring this.
ashu3103 commentedon Mar 18, 2025
@jesperpedersen, I was thinking upon it and there are some things that are still not very clear.
as far as I understand from testsuite API, you mean that it is not a separate process (like main, cli, admin etc) but more like a library that we can import in our tests and execute (and its usecase is limited to
testdirectory).If we make it a library, how will it be able to get the configuration file paths of the pgmoneta by itself.
Maybe I am missing something here.
jesperpedersen commentedon Mar 18, 2025
Yes, it is just an API that make the calls to the server
ashu3103 commentedon Mar 18, 2025
Shall I assume default configurations file location in this API?
like
build/pgmoneta-testsuite/conf/pgmoneta.confthat we set for main process in thetestsuite.shscript.So in each testcase -
testcase passedelsetestcase failed.jesperpedersen commentedon Mar 18, 2025
Yes.
@Arnabdaz is working on the generator on #516
ashu3103 commentedon Mar 19, 2025
Hi @jesperpedersen,
I was thinking of initializing the tsclient in runner (not in each testcase) and connect to the main server in the initialisation itself (so that we don’t need a new connection for every testcase), so testcase will only execute APIs on the socket (from initialisation) rather than making a new connection every single time.
Is there anything that could go wrong in this?
jesperpedersen commentedon Mar 19, 2025
No, should be ok. And, you can do
pgmoneta_socket_isvalidfor each test case[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[pgmoneta#474] tscli impl
[#474] tscli impl