Commit 71644ca4 authored by Jérome Perrin's avatar Jérome Perrin

Check request and response in schema test

Our schemas test check all files if they are present, but it so far it did not check
that the request and response schema referenced in software.cfg.json were really
existing and they were missing for some softwares.

This extends the test to check that request / response exists and add missing responses for cdn-me and srslte

See merge request !910
parents e190bda9 003508e0
......@@ -59,7 +59,16 @@ def createSoftwareCfgValidatorTest(path, software_cfg_schema):
# which is defined in schema.json in this directory
def run(self, *args, **kwargs):
with open(path, "r") as json_file:
jsonschema.validate(json.load(json_file), software_cfg_schema)
schema = json.load(json_file)
jsonschema.validate(schema, software_cfg_schema)
# also make sure request and response schemas can be resolved
schema.setdefault('$id', 'file://' + path)
resolver = jsonschema.RefResolver.from_schema(schema)
for software_type_definition in schema['software-type'].itervalues():
resolver.resolve(software_type_definition['request'])
resolver.resolve(software_type_definition['response'])
return run
......
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Values returned by CDN ME instanciation",
"properties": {
"url-https": {
"description": "URL to access instance",
"type": "string"
},
"url-http": {
"description": "URL to access instance over unencrypted HTTP",
"type": "string"
},
"token": {
"description": "Token for Re6st",
"type": "string"
},
"ipv6": {
"description": "IPv6 address of the instance",
"type": "string"
},
"ipv4": {
"description": "IPv4 address of the instance",
"type": "string"
},
"monitor_url": {
"description": "URL to access monitoring interface",
"type": "string"
}
},
"type": "object"
}
[buildout]
parts =
request-monitor-test-distributor-slave
publish-connection-informations
publish-connection-information
connection-parameter-http-checker
connection-parameter-checker
......@@ -135,7 +135,7 @@ slave = true
config-url = $${request-monitor-test-distributor-slave:connection-site_url}
return = site_url domain
[publish-connection-informations]
[publish-connection-information]
recipe = slapos.cookbook:publish
url-https = https://$${request-frontend-token-slave:connection-domain}
url = http://$${request-frontend-token-slave:connection-domain}
......@@ -156,6 +156,6 @@ expected-value =
[connection-parameter-http-checker]
recipe = slapos.cookbook:check_parameter
path = $${directory:promise}/check_re6stnet_http
value = $${publish-connection-informations:url}
value = $${publish-connection-information:url}
expected-not-value = http://
expected-value =
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Values returned by srsLTE instanciation",
"properties": {},
"type": "object"
}
......@@ -8,7 +8,7 @@
"software-type": "default",
"description": "Default",
"request": "instance-srslte-input-schema.json",
"response": "instance-srslte-schema.json",
"response": "instance-srslte-output-schema.json",
"index": 1
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment