Skip to content
Snippets Groups Projects
Commit c2cfb98f authored by Robbie Luijben's avatar Robbie Luijben
Browse files

split up test config between local and CI

parent 08702f3e
No related branches found
No related tags found
1 merge request!326bugfix, didn't consider rfi_percent = 0 a valid RFI
Pipeline #64090 passed
...@@ -25,14 +25,14 @@ test-code: ...@@ -25,14 +25,14 @@ test-code:
services: services:
- postgres:14.0 - postgres:14.0
variables: variables:
POSTGRES_DB: atdb_ldv_ci POSTGRES_DB: atdb_ldv_test_ci
POSTGRES_USER: atdb_admin_ci POSTGRES_USER: atdb_admin_test_ci
POSTGRES_PASSWORD: "atdb123_ci" POSTGRES_PASSWORD: "atdb123_test_ci"
script: script:
- cd atdb - cd atdb
- pip install -r requirements/dev.txt - pip install -r requirements/dev.txt
- python manage.py migrate --settings atdb.settings.ci - python manage.py migrate --settings atdb.settings.test_ci
- python manage.py test --settings atdb.settings.ci - python manage.py test --settings atdb.settings.test_ci
# deploy to 'sdc-dev.astron.nl' # deploy to 'sdc-dev.astron.nl'
......
...@@ -114,14 +114,14 @@ See the integration instructions in the [astronauth repo](https://git.astron.nl/ ...@@ -114,14 +114,14 @@ See the integration instructions in the [astronauth repo](https://git.astron.nl/
### Running tests ### Running tests
To run tests, you can spin up a dedicated test database locally using the the provided `docker-compose-ci.yml` file. This test database will not interfere with your local development database. For example, you can run this command from the `atdb/docker` folder: To run tests, you can spin up a dedicated test database locally using the the provided `docker-compose-test-local.yml` file. This test database will not interfere with your local development database. For example, you can run this command from the `atdb/docker` folder:
` docker compose -f .\docker-compose-ci.yml up -d` ` docker compose -f .\docker-compose-test-local.yml up -d`
After spinning up the database, you can execute the tests with the following command: After spinning up the database, you can execute the tests with the following command:
`python manage.py test --settings atdb.settings.ci` `python manage.py test --settings atdb.settings.test_local`
Dedicated settings for running the tests are provided in the `atdb/settings/ci.dev` file. For convenience, `test.bat` is provided to run the above command (Windows only). Dedicated settings for running the tests are provided in the `atdb/settings/test_local.dev` file. For convenience, `test.bat` is provided to run the above command (Windows only).
Finally, these tests are also executed in the CI pipeline through the test stage in the `.gitlab-ci.yml` file. Finally, these tests are also executed in the CI pipeline through the test stage in the `.gitlab-ci.yml` file. For running the tests in the CI pipeline, the settings file `atdb/settings/test_ci.dev` is used.
\ No newline at end of file \ No newline at end of file
...@@ -4,10 +4,10 @@ import os ...@@ -4,10 +4,10 @@ import os
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin_ci', 'USER': 'atdb_admin_test_ci',
'PASSWORD': 'atdb123_ci', 'PASSWORD': 'atdb123_test_ci',
'NAME': 'atdb_ldv_ci', 'NAME': 'atdb_ldv_test_ci',
'HOST': 'localhost', 'HOST': 'postgres',
'PORT': '5432', 'PORT': '5432',
}, },
} }
\ No newline at end of file
from atdb.settings.base import *
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin_test_local',
'PASSWORD': 'atdb123_test_local',
'NAME': 'atdb_ldv_test_local',
'HOST': 'localhost',
'PORT': '5555',
},
}
\ No newline at end of file
...@@ -3,13 +3,13 @@ version: '3.4' ...@@ -3,13 +3,13 @@ version: '3.4'
services: services:
atdb-ldv-db: atdb-ldv-db:
image: postgres:14 image: postgres:14
container_name: atdb-ldv-ci container_name: atdb-ldv-test-local
expose: expose:
- "5432" - "5432"
ports: ports:
- "5432:5432" - "5555:5432"
environment: environment:
POSTGRES_PASSWORD: atdb123_ci POSTGRES_PASSWORD: atdb123_test_local
POSTGRES_USER: atdb_admin_ci POSTGRES_USER: atdb_admin_test_local
POSTGRES_DB: atdb_ldv_ci POSTGRES_DB: atdb_ldv_test_local
python manage.py test --settings atdb.settings.ci python manage.py test --settings atdb.settings.test_local
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment