Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
9bc6a32d
Commit
9bc6a32d
authored
Mar 18, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.test: Test if software.cfg.json don't have duplicated entries
parent
f21c630f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
slapos/test/test_json_schema.py
slapos/test/test_json_schema.py
+9
-2
No files found.
slapos/test/test_json_schema.py
View file @
9bc6a32d
...
@@ -67,13 +67,20 @@ def createSoftwareCfgValidatorTest(path, software_cfg_schema):
...
@@ -67,13 +67,20 @@ def createSoftwareCfgValidatorTest(path, software_cfg_schema):
schema
=
json
.
load
(
json_file
)
schema
=
json
.
load
(
json_file
)
jsonschema
.
validate
(
schema
,
software_cfg_schema
)
jsonschema
.
validate
(
schema
,
software_cfg_schema
)
_viewed_software_type
=
[]
# also make sure request and response schemas can be resolved
# also make sure request and response schemas can be resolved
schema
.
setdefault
(
'$id'
,
'file://'
+
path
)
schema
.
setdefault
(
'$id'
,
'file://'
+
path
)
resolver
=
jsonschema
.
RefResolver
.
from_schema
(
schema
)
resolver
=
jsonschema
.
RefResolver
.
from_schema
(
schema
)
for
software_type_definition
in
six
.
itervalue
s
(
schema
[
'software-type'
]):
for
key
,
software_type_definition
in
six
.
iteritem
s
(
schema
[
'software-type'
]):
resolver
.
resolve
(
software_type_definition
[
'request'
])
resolver
.
resolve
(
software_type_definition
[
'request'
])
resolver
.
resolve
(
software_type_definition
[
'response'
])
resolver
.
resolve
(
software_type_definition
[
'response'
])
# Ensure there inst a duplicated entry.
_software_type_tuple
=
(
software_type_definition
.
get
(
"software-type"
,
key
),
software_type_definition
.
get
(
"shared"
,
False
))
assert
_software_type_tuple
not
in
_viewed_software_type
,
\
"Duplicated software release on %s, shared: %s"
%
_software_type_tuple
_viewed_software_type
.
append
(
_software_type_tuple
)
return
run
return
run
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment