Commit 91f268e0 authored by Jérome Perrin's avatar Jérome Perrin

Include JSON schema lint in SR test suite

Usually when we make change to SlapOS profiles, we only check the result of SR test and sometimes problems in the json schema are introduced and we only notice this when we check the result of `SLAPOS-EGG-TEST`.

This MR is about:
  - also running `slapos.cookbook` tests as part of `SLAPOS-SR-TEST`. This test in fact contain both "egg tests" for some recipes in nexedi/slapos repository and "lint test" for the formatting of json schemas for parameters (because this nexedi/slapos repository contain both some recipes and profiles).
  - fixing current problems with json schemas on master branch.

/reviewed-on !612
parents a4205a48 74a50d0a
...@@ -40,15 +40,30 @@ def makeRecipe(recipe_class, options, name='test', slap_connection=None): ...@@ -40,15 +40,30 @@ def makeRecipe(recipe_class, options, name='test', slap_connection=None):
buildout['slap-connection'] = slap_connection buildout['slap-connection'] = slap_connection
# are we in buildout folder ? # are we in buildout folder ?
# the usual layout is # in SLAPOS-EGG-TEST the usual layout is
# ${buildout:directory}/parts/slapos-repository/slapos/test/utils.py , so try # ${buildout:directory}/parts/slapos-repository/slapos/test/utils.py in instance buildout, so try
# to find a buildout relative to this file. # to find a buildout.cfg relative to this file.
buildout_cfg = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'buildout.cfg') # What can also happens is that this repository is used from software folder, this is the case in
# SLAPOS-SR-TEST. In this case, ${buildout:eggs} is not set in buildout.cfg and we can only assume
# it will be the standards eggs and develop-eggs folders.
# {BASE_DIRECTORY}/parts/slapos-repository/slapos/test/utils.py
base_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
buildout_cfg = os.path.join(base_directory, 'buildout.cfg')
if os.path.exists(buildout_cfg): if os.path.exists(buildout_cfg):
parser = ConfigParser() parser = ConfigParser()
parser.readfp(open(buildout_cfg)) parser.readfp(open(buildout_cfg))
eggs_directory = parser.get('buildout', 'eggs-directory') eggs_directory = parser.get(
develop_eggs_directory = parser.get('buildout', 'develop-eggs-directory') 'buildout',
'eggs-directory',
# default, for the case when buildout_cfg is a software buildout
# like with SLAPOS-SR-TEST.
vars={'eggs-directory': os.path.join(base_directory, 'eggs')})
develop_eggs_directory = parser.get(
'buildout',
'develop-eggs-directory',
vars={'develop-eggs-directory': os.path.join(base_directory, 'develop-eggs')})
logging.getLogger(__name__).info( logging.getLogger(__name__).info(
'Using eggs-directory (%s) and develop-eggs-directory (%s) from buildout at %s', 'Using eggs-directory (%s) and develop-eggs-directory (%s) from buildout at %s',
eggs_directory, eggs_directory,
......
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
"textarea": true, "textarea": true,
"title": "[DEPRECATED] SSL Key", "title": "[DEPRECATED] SSL Key",
"type": "string" "type": "string"
}, },
"ssl_ca_crt": { "ssl_ca_crt": {
"default": "", "default": "",
"description": "Content of the CA certificate file. Deprecated, please use key-upload-url.", "description": "Content of the CA certificate file. Deprecated, please use key-upload-url.",
......
{ {
"$schema": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#",
"description": "Parameters to instantiate Grafana", "description": "Parameters to instantiate Grafana",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"domain": { "domain": {
"title": "Authorized domain on nextcloud", "title": "Authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.", "description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string" "type": "string"
}, },
"monitor-interface-url": { "monitor-interface-url": {
"title": "Monitor Web Interface URL", "title": "Monitor Web Interface URL",
"description": "Give Url of HTML web interface that will be used to render this monitor instance.", "description": "Give Url of HTML web interface that will be used to render this monitor instance.",
"type": "string", "type": "string",
"format": "uri", "format": "uri",
"default": "https://monitor.app.officejs.com" "default": "https://monitor.app.officejs.com"
}, },
"monitor-cors-domains": { "monitor-cors-domains": {
"title": "Monitor CORS domains", "title": "Monitor CORS domains",
"description": "List of cors domains separated with space. Needed for ajax query on this monitor instance from a different domain.", "description": "List of cors domains separated with space. Needed for ajax query on this monitor instance from a different domain.",
"type": "string", "type": "string",
"default": "monitor.app.officejs.com" "default": "monitor.app.officejs.com"
}, },
"innodb-file-per-table": { "innodb-file-per-table": {
"title": "Enable/disable innodb_file_per_table", "title": "Enable/disable innodb_file_per_table",
"description": "See MariaDB documentation on innodb_file_per_table", "description": "See MariaDB documentation on innodb_file_per_table",
"minimum": 0, "minimum": 0,
"maximum": 1, "maximum": 1,
"default": 0, "default": 0,
"type": "integer" "type": "integer"
}, },
"apache-computer-guid": { "apache-computer-guid": {
"title": "Computer ID for Apache Instance.", "title": "Computer ID for Apache Instance.",
"description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.", "description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.",
"type": "string" "type": "string"
}, },
"mariadb-computer-guid": { "mariadb-computer-guid": {
"title": "Computer ID for Mariadb Instance.", "title": "Computer ID for Mariadb Instance.",
"description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.", "description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.",
"type": "string" "type": "string"
}, },
"instance.mail-from": { "instance.mail-from": {
"title": "Mail from", "title": "Mail from",
"description": "From", "description": "From",
"type": "string" "type": "string"
}, },
"instance.mail-domain": { "instance.mail-domain": {
"title": "Mail domain name", "title": "Mail domain name",
"description": "Domain name", "description": "Domain name",
"type": "string" "type": "string"
}, },
"instance.mail-smtpauthtype": { "instance.mail-smtpauthtype": {
"title": "SMTP Auth type", "title": "SMTP Auth type",
"description": "Mail SMTP auth type. Default: LOGIN", "description": "Mail SMTP auth type. Default: LOGIN",
"type": "string", "type": "string",
"default": "LOGIN" "default": "LOGIN"
}, },
"instance.mail-smtpauth": { "instance.mail-smtpauth": {
"title": "SMTP auth required", "title": "SMTP auth required",
"description": "Verify SSL certificate of SMTP server. Default: Yes", "description": "Verify SSL certificate of SMTP server. Default: Yes",
"minimum": 0, "minimum": 0,
"maximum": 1, "maximum": 1,
"default": 0, "default": 0,
"type": "integer" "type": "integer"
}, },
"instance.mail-smtpport": { "instance.mail-smtpport": {
"title": "SMTP port", "title": "SMTP port",
"description": "Mail SMTP Port. Default: 587", "description": "Mail SMTP Port. Default: 587",
"type": "integer", "type": "integer",
"default": 587 "default": 587
}, },
"instance.mail-smtphost": { "instance.mail-smtphost": {
"title": "SMTP host", "title": "SMTP host",
"description": "Mail SMTP host", "description": "Mail SMTP host",
"type": "string" "type": "string"
}, },
"instance.mail-smtpname": { "instance.mail-smtpname": {
"title": "SMTP name", "title": "SMTP name",
"description": "Mail SMTP server name.", "description": "Mail SMTP server name.",
"type": "string" "type": "string"
}, },
"instance.mail-smtppassword": { "instance.mail-smtppassword": {
"title": "SMTP password", "title": "SMTP password",
"description": "Password to connect to SMTP server.", "description": "Password to connect to SMTP server.",
"type": "string" "type": "string"
}, },
"instance.collabora-url": { "instance.collabora-url": {
"title": "Collabora URL", "title": "Collabora URL",
"description": "Collabora server URL", "description": "Collabora server URL",
"type": "string", "type": "string",
"format": "uri", "format": "uri",
"default": "https://collabora.host.vifib.net" "default": "https://collabora.host.vifib.net"
}, },
"instance.stun-server": { "instance.stun-server": {
"title": "Stun server address", "title": "Stun server address",
"description": "Hostname of stun server. Default: turn.vifib.com:5349", "description": "Hostname of stun server. Default: turn.vifib.com:5349",
"type": "string", "type": "string",
"default": "turn.vifib.com:5349" "default": "turn.vifib.com:5349"
}, },
"instance.turn-server": { "instance.turn-server": {
"title": "Turn server address", "title": "Turn server address",
"description": "Hostname of turn server.", "description": "Hostname of turn server.",
"default": "", "default": "",
"type": "string" "type": "string"
}, },
"instance.turn-secret": { "instance.turn-secret": {
"title": "Turn server secret", "title": "Turn server secret",
"description": "Turn secret to use for authentification.", "description": "Turn secret to use for authentification.",
"type": "string" "type": "string"
}, },
"instance.cli-url": { "instance.cli-url": {
"title": "Nextcloud cli URL", "title": "Nextcloud cli URL",
"description": "Nextcloud cli URL, the default will be Nextcloud url.", "description": "Nextcloud cli URL, the default will be Nextcloud url.",
"type": "string", "type": "string",
"format": "uri" "format": "uri"
}, },
"instance.trusted-domain-1": { "instance.trusted-domain-1": {
"title": "Authorized domain on nextcloud", "title": "Authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.", "description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string" "type": "string"
}, },
"instance.trusted-domain-2": { "instance.trusted-domain-2": {
"title": "Second authorized domain on nextcloud", "title": "Second authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.", "description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string" "type": "string"
}, },
"instance.trusted-domain-3": { "instance.trusted-domain-3": {
"title": "Third authorized domain on nextcloud", "title": "Third authorized domain on nextcloud",
"description": "Trusted domain used to connect to Nextcloud instance.", "description": "Trusted domain used to connect to Nextcloud instance.",
"type": "string" "type": "string"
} }
} }
} }
\ No newline at end of file
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 6e4bde9074cdc508df513e31653e7def md5sum = 81b01eb048e0db93bf0152504bf8a04d
...@@ -28,7 +28,7 @@ bin = $${buildout:directory}/bin ...@@ -28,7 +28,7 @@ bin = $${buildout:directory}/bin
working-dir = $${buildout:directory}/tmp working-dir = $${buildout:directory}/tmp
[test-list] [test-list]
path_list = ${slapos.test.caddy-frontend-setup:setup},${slapos.test.erp5-setup:setup},${slapos.test.slapos-master-setup:setup},${slapos.test.kvm-setup:setup},${slapos.test.monitor-setup:setup},${slapos.test.plantuml-setup:setup},${slapos.test.powerdns-setup:setup},${slapos.test.proftpd-setup:setup},${slapos.test.re6stnet-setup:setup},${slapos.test.seleniumserver-setup:setup},${slapos.test.slaprunner-setup:setup},${slapos.test.helloworld-setup:setup},${slapos.test.jupyter-setup:setup},${slapos.test.nextcloud-setup:setup} path_list = ${slapos.cookbook-setup:setup},${slapos.test.caddy-frontend-setup:setup},${slapos.test.erp5-setup:setup},${slapos.test.slapos-master-setup:setup},${slapos.test.kvm-setup:setup},${slapos.test.monitor-setup:setup},${slapos.test.plantuml-setup:setup},${slapos.test.powerdns-setup:setup},${slapos.test.proftpd-setup:setup},${slapos.test.re6stnet-setup:setup},${slapos.test.seleniumserver-setup:setup},${slapos.test.slaprunner-setup:setup},${slapos.test.helloworld-setup:setup},${slapos.test.jupyter-setup:setup},${slapos.test.nextcloud-setup:setup}
[slapos-test-runner] [slapos-test-runner]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
......
...@@ -22,6 +22,11 @@ parts = ...@@ -22,6 +22,11 @@ parts =
[setup-develop-egg] [setup-develop-egg]
recipe = zc.recipe.egg:develop recipe = zc.recipe.egg:develop
[slapos.cookbook-setup]
<= setup-develop-egg
egg = slapos.cookbook
setup = ${slapos-repository:location}/
[slapos.test.caddy-frontend-setup] [slapos.test.caddy-frontend-setup]
<= setup-develop-egg <= setup-develop-egg
egg = slapos.test.caddy-frontend egg = slapos.test.caddy-frontend
...@@ -102,6 +107,7 @@ eggs = ...@@ -102,6 +107,7 @@ eggs =
${bcrypt:egg} ${bcrypt:egg}
slapos.libnetworkcache slapos.libnetworkcache
slapos.core slapos.core
${slapos.cookbook-setup:egg}
${slapos.test.caddy-frontend-setup:egg} ${slapos.test.caddy-frontend-setup:egg}
${slapos.test.erp5-setup:egg} ${slapos.test.erp5-setup:egg}
${slapos.test.slapos-master-setup:egg} ${slapos.test.slapos-master-setup:egg}
......
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