Closed moylop260 closed 6 years ago
After many tests, It can be fixed using:
subprocess.call("/etc/init.d/postgresql stop", shell=True)
at bottom of the file travis/travis_run_tests
.
All the records are deleted if the container is stopped without stop the postgresql service before.
Maybe there are other ways like a checkpoint
command or "flush"
but I didn't test them yet.
Description:
Use SQL-CREATETABLE-UNLOGGED recommended for non-durability databases from https://github.com/Vauxoo/maintainer-quality-tools/pull/280 the database generated from runbot are empty after a success log.
Steps to reproduce it:
Using the following dummy PR: https://git.vauxoo.com/vauxoo/enterprise-mx/merge_requests/355
Run
travisfile2dockerfile git@git.vauxoo.com:vauxoo/enterprise-mx.git pull/355
Run./10-build.sh --no-cache
script. Run./20-run.sh "--name=ent-mx-11-untagged --entrypoint=/entrypoint.sh"
Wait... (You can see the logs using:docker logs -f ent-mx-11-untagged
) After finished it the container will stoped. Start the container:docker start ent-mx-11-untagged
Verify the records:docker exec -it ent-mx-11-untagged psql openerp_test -c "SELECT * FROM res_users"
Saw:
Result: 0 records
Expected:
Result: > 0 records
Note 1:
We had a similar issue in the past fixing it using a sleep before to stop the container in order to wait postgresql flush process. Maybe we should to call
/etc/init.d/postgresql stop
process before to finish the script if it is a runbot or it is runningentrypoint=/entrypoint.sh
or another flag.Note 2:
We should apply UNLOGGED configuration just for the case where is runbot because of locally for the developers will be a headache if they need to run a
docker stop ...