Skip to content

Commit

Permalink
ci: Test against live mreg instance.
Browse files Browse the repository at this point in the history
* .github/workflows/test.yml (jobs)[integration]: New job.
  • Loading branch information
mbakke committed Jul 1, 2021
1 parent fb64e39 commit 5e6bda6
Showing 1 changed file with 64 additions and 1 deletion.
65 changes: 64 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
name: CI
jobs:
test:
name: Test
name: Fixtures
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -35,3 +35,66 @@ jobs:
pip install -e .
- name: Test
run: mreg-cli --playback testsuite-result.json

integration:
name: Integration
runs-on: ubuntu-latest
strategy:
matrix:
postgresql-version: [11, 12, 13]
services:
postgres:
image: postgres:${{ matrix.postgresql-version }}
env:
POSTGRES_USER: mreg
POSTGRES_DB: mreg
POSTGRES_PASSWORD: postgres
# Add health checks and trick it into creating the citext
# extension when ready.
options: >-
--health-cmd "pg_isready && PGPASSWORD=$POSTGRES_PASSWORD psql -U mreg -c 'CREATE EXTENSION IF NOT EXISTS citext;' mreg || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mreg:
image: ghcr.io/unioslo/mreg:latest
options: >-
--name mreg
env:
GUNICORN_ARGS: --bind=0.0.0.0
MREG_DB_HOST: postgres
MREG_DB_PASSWORD: postgres
ports:
- 8000:8000
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: v1-pip-${{ runner.os }}-${{ hashFiles('requirements-*.txt') }}
restore-keys: |
v1-pip-${{ runner.os }}
v1-pip-
- name: Install
run: |
pip install -r requirements.txt
pip install -e .
- name: Create superuser
run: |
echo -ne '
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
user = get_user_model().objects.create_user(
username="ci",password="test")
user.groups.clear()
su = getattr(settings, "SUPERUSER_GROUP", None)
group, created = Group.objects.get_or_create(name=su)
group.user_set.add(user)
' | docker exec -i mreg python /app/manage.py shell
- name: Run tests
run: >
echo -ne 'test\nsource testsuite\nquit\n'
| mreg-cli -u ci -d example.org --url http://localhost:8000

0 comments on commit 5e6bda6

Please sign in to comment.