blob: 8a4a50a3443ea1388d62d3fcd81b9c721d92492f [file] [log] [blame]
name: Integration Tests
# TODO: add some useful tests
on:
push:
paths:
- '**/integration-tests.yml'
- 'test/itest*'
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
env:
discovery.type: single-node
xpack.security.enabled: false
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
# <port on host>:<port on container>
- 9200:9200
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tools/requirements.txt
pip install -r server/requirements.txt
pip install -r test/requirements.txt
- name: Basic test
run: |
curl -sq "http://localhost:9200/_cluster/health?level=indices&pretty"
- name: Database setup
run: |
cd tools
./setup.py --defaults --devel
echo archiver.yaml
cat archiver.yaml
cd ..
# add some oauth entries for use by the testauth plugin
cat >>server/ponymail.yaml <<EOD
authoritative_domains:
- localhost
admins:
- admin@apache.org
EOD
echo server/ponymail.yaml
cat server/ponymail.yaml
- name: Show Database
run: |
curl -sq "http://localhost:9200/_cat/indices?v"
curl -sq "http://localhost:9200/_settings?pretty"
curl -sq "http://localhost:9200/ponymail-mbox/_mapping?pretty"
curl -sq "http://localhost:9200/ponymail-source/_mapping?pretty"
- name: load Database
run: |
# The early messages were under incubator ...
tools/import-mbox.py --source test/resources/users_ponymail_apache_org_2019-09.mbox --private --lid users.ponymail.apache.org
tools/import-mbox.py --source test/resources/users_ponymail_apache_org_2022-01.mbox
tools/import-mbox.py --source test/resources/dev_ponymail_apache_org_2020-10.mbox
- name: Server
run: |
cd server
python -u main.py --apilog DEBUG --logger DEBUG --stoppable --refreshable --testendpoints > main.log 2>&1 &
sleep 5 # allow time to start up properly
curl -sq http://localhost:8080/api/refresh # This will fail if the server is not ready
- name: Show Database
if: always()
run: |
curl -sq "http://localhost:9200/_cat/indices?v"
- name: preferences1
if: always()
run: |
curl -sq http://localhost:8080/api/preferences.lua
- name: stats1
if: always()
run: |
curl -sq 'http://localhost:8080/api/stats.lua?list=*&domain=ponymail.apache.org&d=gte=0d&emailsOnly'
- name: Test against database emails
run: |
python -m pytest -s test/itest_integration.py
- name: Shutdown
if: always()
run: |
curl -sq "http://localhost:9200/_cat/indices?v"
curl -sq -H 'Content-Type: application/json' 'localhost:9200/ponymail-account/_search?pretty' -d '{ "size": 1000, "query": { "match_all": {} }}'
curl -sq -H 'Content-Type: application/json' 'localhost:9200/ponymail-session/_search?pretty' -d '{ "size": 1000, "query": { "match_all": {} }}'
curl -sq http://localhost:8080/api/stop
- name: Show log
if: always()
run: |
cat server/main.log