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::
135
135
$ export DB_USER=gino DB_PASS=gino DB_NAME=gino
136
136
$ py.test
137
137
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.
139
139
Terminal 1 (server)::
140
140
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
142
146
143
147
Terminal 2 (client)::
144
148
145
- $ psql -h localhost -p 5433 -U postgres
146
-
147
- Now run create role/database commands described above.
148
-
149
- Terminal 3 (python)::
150
-
151
149
$ 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;"
152
152
$ pytest tests/test_aiohttp.py
Original file line number Diff line number Diff line change @@ -158,12 +158,14 @@ Contribute
158
158
There are a few tasks in GitHub issues marked as ``help wanted ``. Please feel
159
159
free to take any of them and pull requests are greatly welcome.
160
160
161
- To run tests (please read more in CONTRIBUTING.rst) :
161
+ To run tests:
162
162
163
163
.. code-block :: console
164
164
165
165
$ python setup.py test
166
166
167
+ For the tests to be run, a database has to be available (please read more in CONTRIBUTING.rst)
168
+
167
169
Meanwhile, these are also very much appreciated:
168
170
169
171
* Just use it, tap the star and spread the love :)
You can’t perform that action at this time.
0 commit comments