Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
Add property based testing to readers API using schemathesis
Browse files Browse the repository at this point in the history
Signed-off-by: Rodney Osodo <[email protected]>
  • Loading branch information
rodneyosodo committed Dec 18, 2023
1 parent a4560d3 commit 18f452a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ env:
TWINS_URL: http://localhost:9018
PROVISION_URL: http://localhost:9016
SMPP_NOTIFIER_URL: http://localhost:9014
INFLUXDB_READER_URL: http://localhost:9005

jobs:
api-test:
Expand Down Expand Up @@ -232,6 +233,16 @@ jobs:
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-unique-data --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

- name: Run InfluxDB Reader API tests
if: steps.changes.outputs.readers == 'true'
uses: schemathesis/action@v1
with:
schema: api/openapi/readers.yml
base-url: ${{ env.INFLUXDB_READER_URL }}
checks: all
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-unique-data --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

- name: Stop containers
if: always()
run: make run down args="-v"
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ test_api_certs: TEST_API_URL := http://localhost:9019
test_api_twins: TEST_API_URL := http://localhost:9018
test_api_provision: TEST_API_URL := http://localhost:9016
test_api_notifiers: TEST_API_URL := http://localhost:9014 # Either smtp (http://localhost:9015) or smpp (http://localhost:9014)
test_api_readers: TEST_API_URL := http://localhost:9005 # Either influxdb (http://localhost:9005) or mongodb (http://localhost:9007) or cassandra (http://localhost:9003) or postgres (http://localhost:9009) or timescale (http://localhost:9011)

$(TEST_API):
$(call test_api_service,$(@),$(TEST_API_URL))
Expand Down
2 changes: 1 addition & 1 deletion api/openapi/readers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ components:
HealthRes:
description: Service Health Check.
content:
application/json:
application/health+json:
schema:
$ref: "./schemas/HealthInfo.yml"

Expand Down

0 comments on commit 18f452a

Please sign in to comment.