diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml index b415f70275..f321432098 100644 --- a/.github/workflows/api-tests.yml +++ b/.github/workflows/api-tests.yml @@ -36,6 +36,11 @@ env: CERTS_URL: http://localhost:9019 TWINS_URL: http://localhost:9018 PROVISION_URL: http://localhost:9016 + CASSANDRA_READER_URL: http://localhost:9003 + INFLUX_READER_URL: http://localhost:9005 + MONGO_READER_URL: http://localhost:9007 + POSTGRES_READER_URL: http://localhost:9009 + TIMESCALE_READER_URL: http://localhost:9011 jobs: api-test: @@ -203,6 +208,62 @@ 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: Seed Messages + if: steps.changes.outputs.readers == 'true' + run: | + make cli + ./build/cli provision test + + - name: Run Cassandra Reader API tests + if: steps.changes.outputs.readers == 'true' + uses: schemathesis/action@v1 + with: + schema: api/openapi/readers.yml + base-url: ${{ env.CASSANDRA_READER_URL }} + checks: all + report: false + args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links' + + - name: Run Influx Reader API tests + if: steps.changes.outputs.readers == 'true' + uses: schemathesis/action@v1 + with: + schema: api/openapi/readers.yml + base-url: ${{ env.INFLUX_READER_URL }} + checks: all + report: false + args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links' + + - name: Run Mongo Reader API tests + if: steps.changes.outputs.readers == 'true' + uses: schemathesis/action@v1 + with: + schema: api/openapi/readers.yml + base-url: ${{ env.MONGO_READER_URL }} + checks: all + report: false + args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links' + + - name: Run Postgres Reader API tests + if: steps.changes.outputs.readers == 'true' + uses: schemathesis/action@v1 + with: + schema: api/openapi/readers.yml + base-url: ${{ env.POSTGRES_READER_URL }} + checks: all + report: false + args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links' + + - name: Run Timescale Reader API tests + if: steps.changes.outputs.readers == 'true' + uses: schemathesis/action@v1 + with: + schema: api/openapi/readers.yml + base-url: ${{ env.TIMESCALE_READER_URL }} + checks: all + report: false + args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links' + - name: Stop containers if: always() run: make run down args="-v" diff --git a/Makefile b/Makefile index a6ffce42c7..04d5516a7f 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,7 @@ test_api_bootstrap: TEST_API_URL := http://localhost:9013 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_readers: TEST_API_URL := http://localhost:9009 # This can be the URL of any reader service. $(TEST_API): $(call test_api_service,$(@),$(TEST_API_URL)) diff --git a/api/openapi/readers.yml b/api/openapi/readers.yml index 0eadeb1771..e82de3fb1b 100644 --- a/api/openapi/readers.yml +++ b/api/openapi/readers.yml @@ -37,6 +37,7 @@ tags: paths: /channels/{chanId}/messages: get: + operationId: getMessages summary: Retrieves messages sent to single channel description: | Retrieves a list of messages sent to specific channel. Due to @@ -70,6 +71,7 @@ paths: $ref: "#/components/responses/ServiceError" /health: get: + operationId: health summary: Retrieves service health check info. tags: - health @@ -278,7 +280,7 @@ components: HealthRes: description: Service Health Check. content: - application/json: + application/health+json: schema: $ref: "./schemas/HealthInfo.yml"