Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@
},
"required": [
"schema_version",
"initial_run_target"
"initial_run_target",
"fallback_run_target"
],
"additionalProperties": false
}
2 changes: 0 additions & 2 deletions scripts/config_mapping/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def test_custom_validation_failures(schema_file):
Test that custom validation checks implemented in lifecycle_config.py are correctly identifying invalid configurations.
The input configuration contains the following issues:
* The run target "Minimal" has a recovery action that switches to a run target "Fallback" instead of "fallback_run_target"
* The mandatory "fallback_run_target" is missing from the configuration
* Reserved name "fallback_run_target" is used for a RunTarget name which is not allowed
"""
test_name = "custom_validation_failures_test"
Expand All @@ -188,7 +187,6 @@ def test_custom_validation_failures(schema_file):

expected_errors = [
'recovery RunTarget must be set to "fallback_run_target"',
"fallback_run_target is a mandatory configuration",
'RunTarget name "fallback_run_target" is reserved',
]
actual_error_output = e.stderr
Expand Down
6 changes: 0 additions & 6 deletions scripts/config_mapping/lifecycle_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,6 @@ def custom_validations(config):
)
success = False

if "fallback_run_target" not in config:
report_error(
"fallback_run_target is a mandatory configuration but was not found in the config."
)
success = False

try:
check_cyclic_dependencies(config)
except ValueError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@
}
}
},
"initial_run_target": "Minimal"
"initial_run_target": "Minimal",
"fallback_run_target": {
"depends_on": []
}
}
18 changes: 11 additions & 7 deletions scripts/config_mapping/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,6 @@ def test_custom_validations_ready_condition_both_states(full_valid_config):
assert custom_validations(full_valid_config) is False


def test_custom_validations_missing_fallback_run_target(full_valid_config):
"""fallback_run_target is mandatory."""
del full_valid_config["fallback_run_target"]
assert custom_validations(full_valid_config) is False


def test_custom_validations_cyclic_deps_fails(full_valid_config):
"""Cyclic dependencies from check_cyclic_dependencies should be caught."""
full_valid_config["components"]["c1"] = {
Expand All @@ -766,7 +760,6 @@ def test_custom_validations_multiple_errors(full_valid_config):
"""When multiple validations fail all errors are reported and result is False."""
full_valid_config["run_targets"]["fallback_run_target"] = {"depends_on": []}
full_valid_config["run_targets"]["app1"] = {"depends_on": []}
del full_valid_config["fallback_run_target"]
assert custom_validations(full_valid_config) is False


Expand Down Expand Up @@ -1406,3 +1399,14 @@ def test_schema_validation_rejects_out_of_range_ms_field(schema_file):
schema_validation(_minimal_config_with_ready_timeout_ms(4294967296), schema)
is False
)


def test_schema_validation_requires_fallback_run_target(schema_file):
"""fallback_run_target is a mandatory top-level property in the schema."""
schema = load_json_file(schema_file)

config = _minimal_config_with_ready_timeout_ms(500)
assert schema_validation(config, schema) is True

del config["fallback_run_target"]
assert schema_validation(config, schema) is False
Loading