mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
NOISSUE - Add property based testing to provision API (#2099)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
This commit is contained in:
@@ -35,6 +35,7 @@ env:
|
||||
BOOTSTRAP_URL: http://localhost:9013
|
||||
CERTS_URL: http://localhost:9019
|
||||
TWINS_URL: http://localhost:9018
|
||||
PROVISION_URL: http://localhost:9016
|
||||
|
||||
jobs:
|
||||
api-test:
|
||||
@@ -192,6 +193,16 @@ jobs:
|
||||
report: false
|
||||
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'
|
||||
|
||||
- name: Run Provision API tests
|
||||
if: steps.changes.outputs.provision == 'true'
|
||||
uses: schemathesis/action@v1
|
||||
with:
|
||||
schema: api/openapi/provision.yml
|
||||
base-url: ${{ env.PROVISION_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"
|
||||
|
||||
@@ -157,6 +157,7 @@ test_api_auth: TEST_API_URL := http://localhost:8189
|
||||
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):
|
||||
$(call test_api_service,$(@),$(TEST_API_URL))
|
||||
|
||||
+18
-10
@@ -36,13 +36,17 @@ paths:
|
||||
requestBody:
|
||||
$ref: "#/components/requestBodies/ProvisionReq"
|
||||
responses:
|
||||
'201':
|
||||
"201":
|
||||
description: Created
|
||||
'400':
|
||||
"400":
|
||||
description: Failed due to malformed JSON.
|
||||
"401":
|
||||
description: Missing or invalid access token provided.
|
||||
'500':
|
||||
"415":
|
||||
description: Missing or invalid content type.
|
||||
"422":
|
||||
description: Database can't process request.
|
||||
"500":
|
||||
$ref: "#/components/responses/ServiceError"
|
||||
get:
|
||||
summary: Gets current mapping.
|
||||
@@ -52,11 +56,15 @@ paths:
|
||||
tags:
|
||||
- provision
|
||||
responses:
|
||||
'200':
|
||||
"200":
|
||||
$ref: "#/components/responses/ProvisionRes"
|
||||
"401":
|
||||
description: Missing or invalid access token provided.
|
||||
'500':
|
||||
"415":
|
||||
description: Missing or invalid content type.
|
||||
"422":
|
||||
description: Database can't process request.
|
||||
"500":
|
||||
$ref: "#/components/responses/ServiceError"
|
||||
/health:
|
||||
get:
|
||||
@@ -64,9 +72,9 @@ paths:
|
||||
tags:
|
||||
- health
|
||||
responses:
|
||||
'200':
|
||||
"200":
|
||||
$ref: "#/components/responses/HealthRes"
|
||||
'500':
|
||||
"500":
|
||||
$ref: "#/components/responses/ServiceError"
|
||||
|
||||
components:
|
||||
@@ -84,9 +92,9 @@ components:
|
||||
external_id:
|
||||
type: string
|
||||
external_key:
|
||||
type: string
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
type: string
|
||||
|
||||
responses:
|
||||
ServiceError:
|
||||
@@ -100,7 +108,7 @@ components:
|
||||
HealthRes:
|
||||
description: Service Health Check.
|
||||
content:
|
||||
application/json:
|
||||
application/health+json:
|
||||
schema:
|
||||
$ref: "./schemas/HealthInfo.yml"
|
||||
|
||||
|
||||
@@ -135,8 +135,9 @@ func loadConfig() (provision.Config, error) {
|
||||
return provision.Config{}, errFailedToReadBootstrapContent
|
||||
}
|
||||
}
|
||||
cfg.Bootstrap.Content = content
|
||||
|
||||
cfg.Bootstrap.Content = content
|
||||
// This is default conf for provision if there is no config file
|
||||
cfg.Channels = []mggroups.Group{
|
||||
{
|
||||
Name: "control-channel",
|
||||
@@ -146,7 +147,6 @@ func loadConfig() (provision.Config, error) {
|
||||
Metadata: map[string]interface{}{"type": "data"},
|
||||
},
|
||||
}
|
||||
|
||||
cfg.Things = []mgclients.Client{
|
||||
{
|
||||
Name: "thing",
|
||||
|
||||
Reference in New Issue
Block a user