trying to get tests to pass with hub_model=capsulflask
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -4,9 +4,9 @@ Automated tests could make it safer to contribute code, easier to review new cod
|
||||
|
||||
To run tests:
|
||||
1. create a Postgres database called `capsulflask_test`
|
||||
- e.g.: `docker exec -it d1702306f409 psql -U postgres createdb -O postgres capsulflask_test;`
|
||||
- (`d1702306f409` is the docker container ID of the postgres container)
|
||||
2. run `python -m unittest`
|
||||
- e.g.: `docker exec -it 98e1ddfbbffb createdb -U postgres -O postgres capsulflask_test`
|
||||
- (`98e1ddfbbffb` is the docker container ID of the postgres container)
|
||||
2. run `python3 -m unittest`
|
||||
|
||||
### Architecture
|
||||
|
||||
@ -19,13 +19,13 @@ One outstanding question is how to initialise/reinitialise the test database.
|
||||
Currently, the tests rely on the existence of a capsulflask_test database on localhost, accessible by the postgres user with password dev.
|
||||
|
||||
I create this manually using:
|
||||
`docker exec -it d1702306f409 psql -U postgres createdb -O postgres capsulflask_test;`
|
||||
`docker exec -it 98e1ddfbbffb createdb -U postgres -O postgres capsulflask_test`
|
||||
|
||||
where `d1702306f409` is the docker container ID of the postgres container.
|
||||
where `98e1ddfbbffb` is the docker container ID of the postgres container.
|
||||
|
||||
In between test runs, you can either drop and recreate that database, or manually clear data using:
|
||||
|
||||
`docker exec -it d1702306f409 psql -U postgres capsulflask_test -c "DELETE FROM vms; DELETE FROM login_tokens; DELETE FROM ssh_public_keys; DELETE FROM api_tokens; DELETE FROM accounts;`
|
||||
`docker exec -it 98e1ddfbbffb psql -U postgres capsulflask_test -c "DELETE FROM vm_ssh_authorized_key; DELETE FROM vm_ssh_host_key; DELETE FROM vms; DELETE FROM login_tokens; DELETE FROM ssh_public_keys; DELETE FROM unresolved_btcpay_invoices; DELETE FROM payments; DELETE FROM payment_sessions; DELETE FROM host_operation; DELETE FROM operations; DELETE FROM api_tokens; DELETE FROM accounts;" `
|
||||
|
||||
### Test coverage
|
||||
|
||||
|
Reference in New Issue
Block a user