stages/autotailor: fix stage schema

There was a small mistake in the schema since either one of
`new_profile` or `tailored_profile_id` is required. This commit fixes
this and updates the tests to check for this case.
This commit is contained in:
Gianluca Zuccarelli 2024-07-24 11:09:54 +01:00 committed by Sanne Raymaekers
parent 5bf252a2c1
commit 3fa8ab8cbc
2 changed files with 20 additions and 3 deletions

View file

@ -36,9 +36,21 @@
},
"tailoring": {
"additionalProperties": false,
"required": [
"profile_id",
"datastream"
"oneOf": [
{
"required": [
"profile_id",
"datastream",
"new_profile"
]
},
{
"required": [
"profile_id",
"datastream",
"tailored_profile_id"
]
}
],
"type": "object",
"description": "OpenSCAP configuration variables",

View file

@ -148,6 +148,11 @@ def test_oscap_autotailor_json_smoke(mock_subprocess_run, fake_json_input, stage
"tailored_profile_id": "some-new-profile"
}, "{'datastream': 'some-datastream', 'tailored_profile_id': 'some-new-profile'}"
+ " is not valid under any of the given schemas"),
({
"datastream": "some-datastream",
"profile_id": "some-profile-id",
}, "{'datastream': 'some-datastream', 'profile_id': 'some-profile-id'}"
+ " is not valid under any of the given schemas"),
({
"datastream": "some-datastream",
"tailoring_file": "/some/tailoring/file.json"