File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -135,18 +135,18 @@ Then run the tests like so::
135135 $ export DB_USER=gino DB_PASS=gino DB_NAME=gino
136136 $ py.test
137137
138- Here is an example for db server in docker.
138+ Here is an example for db server in docker. Some tests require ssl so you will need to run postgres with ssl enabled.
139139Terminal 1 (server)::
140140
141- $ docker run --rm -it -p 5433:5432 postgres:10
141+ $ openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
142+ $ openssl rsa -in privkey.pem -passin pass:abcd -out server.key
143+ $ openssl req -x509 -in server.req -text -key server.key -out server.crt
144+ $ chmod 600 server.key
145+ $ docker run --name gino_db --rm -it -p 5433:5432 -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
142146
143147Terminal 2 (client)::
144148
145- $ psql -h localhost -p 5433 -U postgres
146-
147- Now run create role/database commands described above.
148-
149- Terminal 3 (python)::
150-
151149 $ export DB_USER=gino DB_PASS=gino DB_NAME=gino DB_PORT=5433
150+ $ docker exec gino_db psql -U postgres -c "CREATE ROLE $DB_USER WITH LOGIN ENCRYPTED PASSWORD '$DB_PASS'"
151+ $ docker exec gino_db psql -U postgres -c "CREATE DATABASE $DB_NAME WITH OWNER = $DB_USER;"
152152 $ pytest tests/test_aiohttp.py
Original file line number Diff line number Diff line change @@ -158,12 +158,14 @@ Contribute
158158There are a few tasks in GitHub issues marked as ``help wanted ``. Please feel
159159free to take any of them and pull requests are greatly welcome.
160160
161- To run tests (please read more in CONTRIBUTING.rst) :
161+ To run tests:
162162
163163.. code-block :: console
164164
165165 $ python setup.py test
166166
167+ For the tests to be run, a database has to be available (please read more in CONTRIBUTING.rst)
168+
167169Meanwhile, these are also very much appreciated:
168170
169171* Just use it, tap the star and spread the love :)
You can’t perform that action at this time.
0 commit comments