|
@@ -88,42 +88,100 @@ class TestScenarioConfigChecker:
|
|
|
Config._compile_configs()
|
|
|
input_dn_config = DataNodeConfig("input_dn")
|
|
|
output_dn_config = DataNodeConfig("output_dn")
|
|
|
- test_dn_config = DataNodeConfig("test")
|
|
|
+ additional_dn_config = DataNodeConfig("additional_dn")
|
|
|
task_config = TaskConfig("bar", print, [input_dn_config], [output_dn_config])
|
|
|
- test_task_config = TaskConfig("test", print, [test_dn_config], [output_dn_config])
|
|
|
|
|
|
config._sections[ScenarioConfig.name]["new"] = copy(config._sections[ScenarioConfig.name]["default"])
|
|
|
- config._sections[ScenarioConfig.name]["new"]._properties["test"] = "test"
|
|
|
config._sections[ScenarioConfig.name]["new"]._tasks = [task_config]
|
|
|
Config._collector = IssueCollector()
|
|
|
Config.check()
|
|
|
assert len(Config._collector.errors) == 0
|
|
|
|
|
|
- config._sections[ScenarioConfig.name]["new"]._tasks = [test_task_config]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._properties["bar"] = "bar"
|
|
|
+ with pytest.raises(SystemExit):
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 1
|
|
|
+ assert (
|
|
|
+ "The id of the TaskConfig `bar` is overlapping with the property `bar` of ScenarioConfig `new`."
|
|
|
+ in caplog.text
|
|
|
+ )
|
|
|
+
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._tasks = [task_config]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._additional_data_nodes = [additional_dn_config]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._properties["additional_dn"] = "additional_dn"
|
|
|
with pytest.raises(SystemExit):
|
|
|
Config._collector = IssueCollector()
|
|
|
Config.check()
|
|
|
assert len(Config._collector.errors) == 2
|
|
|
assert (
|
|
|
- "The id of the TaskConfig `test` is overlapping with the property `test` of ScenarioConfig `new`."
|
|
|
+ "The id of the DataNodeConfig `additional_dn` is overlapping"
|
|
|
+ " with the property `additional_dn` of ScenarioConfig `new`." in caplog.text
|
|
|
+ )
|
|
|
+
|
|
|
+ config._sections[ScenarioConfig.name]["new"].add_sequences({"sq": [task_config]})
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._properties["sq"] = "sq"
|
|
|
+ with pytest.raises(SystemExit):
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 3
|
|
|
+ assert "The sequence name `sq` is overlapping with the property `sq` of ScenarioConfig `new`." in caplog.text
|
|
|
+
|
|
|
+ def test_check_if_children_ids_are_overlapping(self, caplog):
|
|
|
+ config = Config._applied_config
|
|
|
+ Config._compile_configs()
|
|
|
+ input_dn_config = DataNodeConfig("input_dn")
|
|
|
+ output_dn_config = DataNodeConfig("output_dn")
|
|
|
+ test_dn_config = DataNodeConfig("test")
|
|
|
+ bar_dn_config = DataNodeConfig("bar")
|
|
|
+ test_task_config = TaskConfig("test", print, [test_dn_config], [output_dn_config])
|
|
|
+ bar_task_config = TaskConfig("bar", print, [input_dn_config], [output_dn_config])
|
|
|
+
|
|
|
+ config._sections[ScenarioConfig.name]["new"] = copy(config._sections[ScenarioConfig.name]["default"])
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._tasks = [bar_task_config]
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 0
|
|
|
+
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._additional_data_nodes = [bar_dn_config]
|
|
|
+ with pytest.raises(SystemExit):
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 1
|
|
|
+ assert (
|
|
|
+ "The id of the TaskConfig `bar` is overlapping with the data node `bar` of ScenarioConfig `new`."
|
|
|
in caplog.text
|
|
|
)
|
|
|
+
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._tasks = [test_task_config]
|
|
|
+ with pytest.raises(SystemExit):
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 1
|
|
|
assert (
|
|
|
- "The id of the DataNodeConfig `test` is overlapping with the property `test` of ScenarioConfig `new`."
|
|
|
+ "The id of the TaskConfig `test` is overlapping with the data node `test` of ScenarioConfig `new`."
|
|
|
in caplog.text
|
|
|
)
|
|
|
|
|
|
- config._sections[ScenarioConfig.name]["new"]._tasks = [task_config]
|
|
|
- config._sections[ScenarioConfig.name]["new"]._additional_data_nodes = [test_dn_config]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._tasks = [bar_task_config]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._additional_data_nodes = [bar_dn_config]
|
|
|
with pytest.raises(SystemExit):
|
|
|
Config._collector = IssueCollector()
|
|
|
Config.check()
|
|
|
assert len(Config._collector.errors) == 1
|
|
|
assert (
|
|
|
- "The id of the DataNodeConfig `test` is overlapping with the property `test` of ScenarioConfig `new`."
|
|
|
+ "The id of the TaskConfig `bar` is overlapping with the data node `bar` of ScenarioConfig `new`."
|
|
|
in caplog.text
|
|
|
)
|
|
|
|
|
|
+ config._sections[ScenarioConfig.name]["new"].add_sequences({"bar": [bar_task_config]})
|
|
|
+ with pytest.raises(SystemExit):
|
|
|
+ Config._collector = IssueCollector()
|
|
|
+ Config.check()
|
|
|
+ assert len(Config._collector.errors) == 3
|
|
|
+ assert "The sequence name `bar` is overlapping with the data node `bar` of ScenarioConfig `new`." in caplog.text
|
|
|
+ assert "The sequence name `bar` is overlapping with the task `bar` of ScenarioConfig `new`." in caplog.text
|
|
|
+
|
|
|
def test_check_task_configs(self, caplog):
|
|
|
Config._collector = IssueCollector()
|
|
|
config = Config._applied_config
|
|
@@ -197,7 +255,7 @@ class TestScenarioConfigChecker:
|
|
|
assert len(Config._collector.infos) == 0
|
|
|
|
|
|
config._sections[ScenarioConfig.name]["new"] = copy(config._sections[ScenarioConfig.name]["default"])
|
|
|
- config._sections[ScenarioConfig.name]["new"]._tasks = [TaskConfig("bar", print)]
|
|
|
+ config._sections[ScenarioConfig.name]["new"]._tasks = [TaskConfig("foo", print)]
|
|
|
Config._collector = IssueCollector()
|
|
|
Config.check()
|
|
|
assert len(Config._collector.errors) == 0
|
|
@@ -264,7 +322,7 @@ class TestScenarioConfigChecker:
|
|
|
output_dn_config = DataNodeConfig("output_dn")
|
|
|
config._sections[ScenarioConfig.name]["new"] = copy(config._sections[ScenarioConfig.name]["default"])
|
|
|
config._sections[ScenarioConfig.name]["new"]._tasks = [
|
|
|
- TaskConfig("bar", print, [input_dn_config], [output_dn_config])
|
|
|
+ TaskConfig("foo", print, [input_dn_config], [output_dn_config])
|
|
|
]
|
|
|
Config._collector = IssueCollector()
|
|
|
Config.check()
|