initial test impl #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Schemathesis Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test-schema-thesis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Set .env for docker-compose | |
run: | | |
echo "EARLIEST_SEARCH_DATE=$(date -u -d yesterday +'%Y-%m-%dT%H:%M:%SZ')" >> .env | |
echo "SCRAPFLY_APIKEY=${{secrets.SCRAPFLY_APIKEY}}" >> .env | |
cat tests/st/.env.schemathesis >> .env | |
echo ==== env file start ===== | |
cat .env | |
echo | |
echo ==== env file end ===== | |
- name: Start docker-compose | |
uses: hoverkraft-tech/compose-action@v2.0.2 | |
with: | |
compose-file: | | |
docker-compose.yml | |
compose-flags: | |
--env-file .env | |
-p h4f-action | |
- name: Get IP addresses | |
id: get_ip | |
run: | | |
IP_ADDRESS=$(docker network inspect -f '{{range.IPAM.Config}}{{.Gateway}}{{end}}' h4f-action_default) | |
echo "ip_address=$IP_ADDRESS" >> "$GITHUB_OUTPUT" | |
echo "IP_ADDRESS=$IP_ADDRESS" >> "$GITHUB_OUTPUT" | |
echo "SERVICE_BASE_URL=http://$IP_ADDRESS:8002/" >> "$GITHUB_OUTPUT" | |
cat "$GITHUB_OUTPUT" | |
- name: Wait for server to start | |
run: | | |
RETRY_DELAY=3 | |
RETRY_COUNT=10 | |
echo "Waiting for server to start" | |
curl --retry-delay $RETRY_DELAY --retry $RETRY_COUNT --retry-connrefused ${{ steps.get_ip.outputs.SERVICE_BASE_URL }} > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "exiting after waiting $(( $RETRY_DELAY * $RETRY_COUNT )) seconds for server to start" | |
exit 1 | |
fi | |
- name: test all endpoints 1 | |
id: test-endpoints | |
run: | | |
pip install -r tests/requirements.txt | |
export SERVICE_BASE_URL="${{ steps.get_ip.outputs.SERVICE_BASE_URL }}" | |
pytest tests/ | |
- name: run schemathesis | |
uses: schemathesis/action@v1 | |
env: | |
SCHEMATHESIS_HOOKS: tests.st.hooks | |
with: | |
schema: ${{ steps.get_ip.outputs.SERVICE_BASE_URL }}/api/schema/ | |
checks: all | |
wait-for-schema: '30' | |
args: '--generation-allow-x00 false' | |
- name: test delete all | |
id: test-endpoints-2 | |
run: | | |
pip install -r tests/requirements.txt | |
export DELETE_ALL_FEEDS=true | |
export SERVICE_BASE_URL="${{ steps.get_ip.outputs.SERVICE_BASE_URL }}" | |
pytest tests/test_99_delete_all_feeds.py |