Skip to content

Commit

Permalink
Updated test config
Browse files Browse the repository at this point in the history
  • Loading branch information
tonioo committed Feb 16, 2024
1 parent 59c5473 commit 038fbbc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ jobs:
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
Expand All @@ -52,7 +61,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update -y && sudo apt-get install -y librrd-dev rrdtool
sudo apt-get update -y && sudo apt-get install -y librrd-dev rrdtool redis-server
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
Expand All @@ -62,6 +71,11 @@ jobs:
python setup.py develop
cd ../modoboa-radicale
python setup.py develop
echo "Testing redis connection"
redis-cli -h $REDIS_HOST -p $REDIS_PORT ping
env:
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
- name: Install postgres requirements
if: ${{ matrix.database == 'postgres' }}
run: |
Expand All @@ -83,6 +97,8 @@ jobs:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} # get randomly assigned published port
MYSQL_USER: root
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}

- name: Test with pytest and coverage
if: ${{ matrix.python-version == '3.10' && matrix.database == 'postgres' }}
Expand All @@ -91,6 +107,8 @@ jobs:
coverage run --source ../modoboa_radicale manage.py test modoboa_radicale
coverage xml
coverage report
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
env:
# use localhost for the host here because we are running the job on the VM.
# If we were running the job on in a container this would be postgres
Expand Down
18 changes: 18 additions & 0 deletions test_project/test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@

MODOBOA_API_URL = 'https://api.modoboa.org/1/'

# REDIS

REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
REDIS_QUOTA_DB = 0
REDIS_URL = 'redis://{}:{}/{}'.format(REDIS_HOST, REDIS_PORT, REDIS_QUOTA_DB)

# RQ

RQ_QUEUES = {
'dkim': {
'URL': REDIS_URL,
},
'modoboa': {
'URL': REDIS_URL,
},
}

# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

Expand Down

0 comments on commit 038fbbc

Please sign in to comment.