mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 12:06:08 +00:00
config/core: merge params from different files
Ensure that runtime and workload parameters specified across multiple config files and the config section of the agenda are merged rather than overwritten.
This commit is contained in:
parent
fbe9460995
commit
a1bdb7de45
@ -16,6 +16,7 @@
|
||||
import unittest
|
||||
from nose.tools import assert_equal
|
||||
|
||||
from wa.framework.configuration.execution import ConfigManager
|
||||
from wa.utils.misc import merge_config_values
|
||||
|
||||
|
||||
@ -38,3 +39,21 @@ class TestConfigUtils(unittest.TestCase):
|
||||
if v2 is not None:
|
||||
assert_equal(type(result), type(v2))
|
||||
|
||||
|
||||
|
||||
class TestConfigParser(unittest.TestCase):
|
||||
|
||||
def test_param_merge(self):
|
||||
config = ConfigManager()
|
||||
|
||||
config.load_config({'workload_params': {'one': 1, 'three': {'ex': 'x'}}, 'runtime_params': {'aye': 'a'}}, 'file_one')
|
||||
config.load_config({'workload_params': {'two': 2, 'three': {'why': 'y'}}, 'runtime_params': {'bee': 'b'}}, 'file_two')
|
||||
|
||||
assert_equal(
|
||||
config.jobs_config.job_spec_template['workload_parameters'],
|
||||
{'one': 1, 'two': 2, 'three': {'why': 'y'}},
|
||||
)
|
||||
assert_equal(
|
||||
config.jobs_config.job_spec_template['runtime_parameters'],
|
||||
{'aye': 'a', 'bee': 'b'},
|
||||
)
|
||||
|
@ -822,12 +822,12 @@ class JobSpec(Configuration):
|
||||
description='''
|
||||
The name of the workload to run.
|
||||
'''),
|
||||
ConfigurationPoint('workload_parameters', kind=obj_dict,
|
||||
ConfigurationPoint('workload_parameters', kind=obj_dict, merge=True,
|
||||
aliases=["params", "workload_params", "parameters"],
|
||||
description='''
|
||||
Parameter to be passed to the workload
|
||||
'''),
|
||||
ConfigurationPoint('runtime_parameters', kind=obj_dict,
|
||||
ConfigurationPoint('runtime_parameters', kind=obj_dict, merge=True,
|
||||
aliases=["runtime_params"],
|
||||
description='''
|
||||
Runtime parameters to be set prior to running
|
||||
|
Loading…
Reference in New Issue
Block a user