blob: b82b37bbc354bfde1890a6dcdd35a5cb3c87df9c [file] [log] [blame]
name: Integration Tests
# TODO: add some useful tests
on:
push:
paths:
- '**/integration-tests.yml'
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
- name: Basic test
run: |
curl -sq "http://localhost:9200/_cluster/health?level=indices&pretty"
- name: Database setup
run: |
cd tools
./setup.py --defaults --devel
- 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: |
tools/import-mbox.py --source test/resources/n47hcfdt6z70tqxvnhgn3zrdwqgg36yl.mbox
- name: Server
run: |
cd server
python -u main.py --apilog INFO --logger DEBUG --stoppable --refreshable > main.log 2>&1 &
sleep 5 # allow time to start up properly
- name: preferences1
run: |
curl -sq http://localhost:8080/api/preferences.lua
- name: Show Database
if: always()
run: |
curl -sq "http://localhost:9200/_cat/indices?v"
- name: preferences2
if: always()
run: |
curl -sq http://localhost:8080/api/preferences.lua
- name: Refresh
if: always()
run: |
curl -sq http://localhost:8080/api/refresh
sleep 2 # can it take this long?
- name: preferences3
if: always()
run: |
curl -sq http://localhost:8080/api/preferences.lua
- name: Shutdown
if: always()
# continue-on-error: true # curl currently returns non-zero status
run: |
curl -sq http://localhost:8080/api/stop
- name: Show log
if: always()
run: |
cat server/main.log