| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: Integration Tests |
| |
| on: |
| push: |
| paths: |
| - '**/integration-tests.yml' |
| - 'test/itest*' |
| - 'server/**' |
| |
| 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.9' |
| 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 |
| |
| tools/archiver.py <test/resources/users.kafka.apache.org-43276.eml |
| tools/archiver.py <test/resources/jetspeed-user.portals.apache.org-27090.eml |
| tools/archiver.py <test/resources/dev.activemq.apache.org-51149.eml |
| tools/archiver.py <test/resources/dev.activemq.apache.org-52937.eml |
| - 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 |