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 nexedi/slapos!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,
......
...@@ -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