mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
First attempt at getting the API to run for E2E tests
Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
71
.github/workflows/checks.yml
vendored
71
.github/workflows/checks.yml
vendored
@@ -44,6 +44,62 @@ jobs:
|
|||||||
run: npm test
|
run: npm test
|
||||||
- name: Run py tests with coverage
|
- name: Run py tests with coverage
|
||||||
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10 --ignore=tests/end_to_end tests/
|
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10 --ignore=tests/end_to_end tests/
|
||||||
|
- name: Check coverage threshold
|
||||||
|
run: poetry run coverage report --fail-under=90
|
||||||
|
|
||||||
|
end-to-end-tests:
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
POSTGRES_DB: test_notification_api
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
# Maps tcp port 5432 on service container to the host
|
||||||
|
- 5432:5432
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/setup-project
|
||||||
|
- uses: jwalton/gh-find-current-pr@v1
|
||||||
|
id: findPr
|
||||||
|
- uses: ArtiomTr/jest-coverage-report-action@v2
|
||||||
|
with:
|
||||||
|
test-script: npm test
|
||||||
|
output: report-markdown
|
||||||
|
annotations: failed-tests
|
||||||
|
prnumber: ${{ steps.findPr.outputs.number }}
|
||||||
|
- name: Clone API
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: GSA/notifications-api
|
||||||
|
path: './notifications-api'
|
||||||
|
- name: Install API dependencies
|
||||||
|
with:
|
||||||
|
path: './notifications-api'
|
||||||
|
run: make bootstrap
|
||||||
|
env:
|
||||||
|
SQLALCHEMY_DATABASE_TEST_URI: postgresql://user:password@localhost:5432/test_notification_api
|
||||||
|
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
|
||||||
|
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
||||||
|
- name: Run API server
|
||||||
|
with:
|
||||||
|
path: './notifications-api'
|
||||||
|
run: make run-procfile &
|
||||||
|
env:
|
||||||
|
SQLALCHEMY_DATABASE_TEST_URI: postgresql://user:password@localhost:5432/test_notification_api
|
||||||
|
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
|
||||||
|
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
||||||
- name: Run E2E tests
|
- name: Run E2E tests
|
||||||
run: poetry run pytest -v --browser chromium --browser firefox --browser webkit tests/end_to_end
|
run: poetry run pytest -v --browser chromium --browser firefox --browser webkit tests/end_to_end
|
||||||
env:
|
env:
|
||||||
@@ -51,22 +107,9 @@ jobs:
|
|||||||
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
|
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
|
||||||
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
||||||
NOTIFY_E2E_TEST_URI: ${{ secrets.NOTIFY_E2E_TEST_URI }}
|
NOTIFY_E2E_TEST_URI: ${{ secrets.NOTIFY_E2E_TEST_URI }}
|
||||||
|
API_HOST_NAME: http://localhost:6011
|
||||||
- name: Check coverage threshold
|
- name: Check coverage threshold
|
||||||
run: poetry run coverage report --fail-under=90
|
run: poetry run coverage report --fail-under=90
|
||||||
- name: Health check
|
|
||||||
run: |
|
|
||||||
response=$(curl -url ${{secrets.NOTIFY_E2E_TEST_URI}}_status)
|
|
||||||
if grep -q "ok" <<< "$response"; then
|
|
||||||
echo "Health check passed"
|
|
||||||
else
|
|
||||||
echo "Health check failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
NOTIFY_E2E_AUTH_STATE_PATH: ${{ secrets.NOTIFY_E2E_AUTH_STATE_PATH }}
|
|
||||||
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
|
|
||||||
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
|
||||||
NOTIFY_E2E_TEST_URI: ${{ secrets.NOTIFY_E2E_TEST_URI }}
|
|
||||||
|
|
||||||
validate-new-relic-config:
|
validate-new-relic-config:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user