Skip to content

Commit

Permalink
Rewrote readme in tests for faster start of work
Browse files Browse the repository at this point in the history
  • Loading branch information
Saveliy committed Mar 6, 2024
1 parent f397cdb commit 6b7180e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ version: "3.9"

services:

web_server_tests:
image: quay.io/almalinuxorg/albs:latest
env_file:
- test_vars.env
volumes:
- "./alws:/code/alws"
- "./scripts:/code/scripts"
- "./reference_data:/code/reference_data"
- "./tests:/code/tests"
- "./requirements.txt:/code/requirements.txt"
command:
bash -c 'source env/bin/activate && pytest -v --ignore alws/'

db:
image: postgres:13
env_file:
Expand Down
13 changes: 9 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@

`mock_classes.py` - a module which contain base class with `httpx` request method, setup logic for each test suite and HTTP status codes
## How to run tests locally
1. Create `test-almalinux-bs` database
2. Adjust variables in `vars.env`
1. Create `test_vars.env` in the root folder of project
2. Adjust variables in `test_vars.env`
```
POSTGRES_DB="test-almalinux-bs"
POSTGRES_PASSWORD="password"
DATABASE_URL="postgresql+asyncpg://postgres:password@db/test-almalinux-bs"
SYNC_DATABASE_URL="postgresql+psycopg2://postgres:password@db/test-almalinux-bs"
PULP_DATABASE_URL="postgresql+psycopg2://postgres:password@db/test-almalinux-bs"
GITHUB_CLIENT="test-github-client"
GITHUB_CLIENT_SECRET="test-github-secret"
ALTS_TOKEN="test"
JWT_SECRET="test"
```
3. Up docker-compose services
also if you don’t have `vars.env` created, you need to create it and fill it out
3. Up docker-compose services. Before starting docker, make sure that you have local postgres disabled
```bash
docker-compose up -d --no-deps web_server db
```
4. Run `pytest` within `web_server` container
```bash
docker-compose run --no-deps --rm web_server bash -c 'source env/bin/activate && pytest -v --ignore alws/'
docker-compose run --rm web_server_tests
```
- we ignore `alws/` directory because it's contains files which names starts with `test*.py`

0 comments on commit 6b7180e

Please sign in to comment.