Add PostgreSQL role switching#1178
Conversation
|
Thanks for the PR. Actually testing the build and systemtests in container (non rootless) make the test failed |
|
What is written in the log of the SQL server? |
I've increase the log level of postgresql in test While during a valid communication I'm attaching also the trace file of fd during that first backup diff --git i/systemtests/tests/py2plug-fd-postgres/database/setup_local_db.sh.in w/systemtests/tests/py2plug-fd-postgres/database/setup_local_db.sh.in
index 49f196e03..d95b0f398 100755
--- i/systemtests/tests/py2plug-fd-postgres/database/setup_local_db.sh.in
+++ w/systemtests/tests/py2plug-fd-postgres/database/setup_local_db.sh.in
@@ -55,6 +55,13 @@ local_db_prepare_files() {
echo "archive_mode = on"
echo "archive_command = 'cp %p ../wal_archive'"
echo "max_wal_senders = 10"
+ echo "log_connections = on"
+ echo "log_disconnections = on"
+ echo "log_min_messages = info"
+ echo "log_min_error_statement = info"
+ echo "log_error_verbosity = verbose"
+ echo "log_statement = 'all'"
+ echo "log_temp_files = 0"
} >> data/postgresql.conf
}
diff --git i/systemtests/tests/py2plug-fd-postgres/testrunner w/systemtests/tests/py2plug-fd-postgres/testrunner
index ab0651501..ad64113cf 100755
--- i/systemtests/tests/py2plug-fd-postgres/testrunner
+++ w/systemtests/tests/py2plug-fd-postgres/testrunner
@@ -50,7 +50,7 @@ cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
-setdebug level=100 storage=File
+setdebug level=200 trace=1 all
label volume=TestVolume001 storage=File pool=Full
run job=$JobName yes
status director
@@ -63,6 +63,8 @@ END_OF_DATA
run_bareos "$@"
+exit
+
# Now add data to the database and run an incremental job
echo "INSERT INTO t (text, created_on) values ('test for INCR backup', current_timestamp)" | ${PSQL} ${DBNAME} |
|
Very strange, in this log's I don't see any errors. |
|
Actually this PR can't be build, nor can't be tested |
|
Without the full log's(database server, jenkins,test etc.) I can't do anything because on my systems, it works. |
You have a make test working ? here not. |
|
I test it in the live scenario, so I need the all log files to debug your test environment. |
8088fb4 to
ace84cf
Compare
bruno-at-bareos
left a comment
There was a problem hiding this comment.
Hello,
We would like to find the root cause why introducing your code broke the system:py3plug-fd-postgres plugin test present in master.
For this I've pushed also on this branch some increased debug level to the test.
See documentation https://docs.bareos.org/DeveloperGuide/BuildAndTestBareos/systemtests.html#systemtests how to run them.
Of course to be able to merge we need the test to be green like it was before.
To avoid running all the tests but just the interesting one, you can use the following
ctest -vvvv --output-on-failure -R fd-postgres
in your build/systemtests/tests/py3plug-fd-postgres/working subdir you will find the trace from bareos-fd
and postgresql log file is located in database/log/logfile
Maybe you will find why your proposed code is creating a failure in the plugin test.
|
I have try this, but no tests will start: |
|
Hi, you certainly miss the cmake message about needed modules : dateutils and pg8000 |
|
Very interesting both nodules are present. But no reason why py3plug-fd-postgres is disabled. |
Maybe you don't have the python3 devel stack, but just the python2 (sorry, I'm just guessing) Name varying a lot depending on distribution used. |
|
The python3 devel stuff is installed. |
Not sure I understand, it seems we check that major version is 3, but also maybe it will be a good idea to rebase from master anyway. |
|
As far as I understood the test, it will only creates an test database for the test. But no director is set up. |
|
The bareos dir, fd, sd is setup during those part of the code start_test with your code the test is failing with a word "role" if you checkout master the test is working |
|
Using the master from today, will result in the same problem. The log dir for the test are empty. Only an log for the database was created: |
|
After an weekend debug session, it looks like as an general database problem. |
|
Hello, I think you didn't catch the way the tests is run, the regression test use a global server in your environment, bareos_regress or whatever user defined in cmake call is used to connect and create a regress test database used by each bareos test. |
|
Now it is very strange. Using an external db, then the director starts, but the test itself will also use this external db. |
|
Now I can repeat the problem with the test. But as far as work in the live system. I have rewritten it, so that it will work in both scenarios. (test and live system) |
|
Nice addition, I wonder if we can't trick a bit more the test, to not only test without "role" needed but also when it is needed, |
|
For complete testing, 3 tests are needed. But I have not knowledge of writing cmake tests.
|
|
Hi @tuxmaster5000 I completely agree with the 3 cases which would be the nice things to have. See the testrunner script and also the setup_local_database.sh. |
|
I seen an testrunner file, but how will it split into multiple test? I have never used the ctest framework before. |
|
Hello @tuxmaster5000 (sorry for the delay, overloaded by other tasks). |
|
As far as I understand the bareos test world I have created the 3 tests. But I don't see the way do build the "no role" test as an "experted fail" test like it can be done under python. |
|
Hello thanks for the work already done, I'm doing some research how to handle this the best way, and will come back next week with some code proposal. Sorry for the time its taken. |
|
No problem, in the meantime I use my one patched version internal. Thanks for your work. |
cca89a7 to
41e7946
Compare
bruno-at-bareos
left a comment
There was a problem hiding this comment.
After last fixes, approved as all tests pass.
661070a to
5f5ae18
Compare
- move py2plug-fd-postgres to py3plug-fd-postgres - add tests (roles) in py3plug-fd-postgres - add postgresql configuration to increase log verbosity - increase debug level of fd - cleanup extra configuration - use expect_grep for testing result Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
5f5ae18 to
84f8581
Compare
bruno-at-bareos
left a comment
There was a problem hiding this comment.
Final approval after renamed py2 to py3
Add role switching for PostgreSQL.
See https://bugs.bareos.org/view.php?id=1456 for more.
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Source code quality
bareos-check-sources --since-mergedoes not report any problemsgit statusshould not report modifications in the source tree after building and testingTests