From d03c084b60f1cbda0ca5cfa2df9196cdc7519784 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 22 Sep 2025 14:18:35 +0200 Subject: [PATCH] fix: dictionary => structure --- .../errors/all.json | 4 +++ .../errors/mandatories.json | 4 +++ .../file/all.env | 3 ++ .../file/all_exclude.env | 3 ++ .../file/mandatories.env | 2 ++ .../makedict/all.json | 5 ++++ .../makedict/mandatories.json | 5 ++++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 15 ++++++++++ .../makedict/mandatories.json | 11 ++++++++ .../errors/all.json | 4 +++ .../errors/mandatories.json | 4 +++ .../file/all.env | 3 ++ .../file/all_exclude.env | 3 ++ .../file/mandatories.env | 2 ++ .../makedict/all.json | 5 ++++ .../makedict/mandatories.json | 5 ++++ .../errors/all.json | 6 ++++ .../errors/mandatories.json | 4 +++ .../file/all.env | 2 ++ .../file/all_exclude.env | 2 ++ .../file/mandatories.env | 1 + .../makedict/all.json | 15 ++++++++++ .../makedict/mandatories.json | 11 ++++++++ tests/test_load.py | 28 +++++++++---------- 29 files changed, 148 insertions(+), 14 deletions(-) create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/errors/all.json create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/errors/mandatories.json create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/file/all.env create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/file/all_exclude.env create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/file/mandatories.env create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/all.json create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/errors/all.json create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/errors/mandatories.json create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/file/all.env create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/file/all_exclude.env create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/file/mandatories.env create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/makedict/all.json create mode 100644 tests/results/test/44_4disabled_calcultion_follower_index/makedict/mandatories.json create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/all.json create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/mandatories.json create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all.env create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all_exclude.env create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/mandatories.env create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/all.json create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/all.json create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/mandatories.json create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all.env create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all_exclude.env create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/mandatories.env create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/all.json create mode 100644 tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/mandatories.json diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/all.json b/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/all.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/all.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/mandatories.json b/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/mandatories.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/errors/mandatories.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all.env b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all.env new file mode 100644 index 0000000..000c6a3 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all.env @@ -0,0 +1,3 @@ +ROUGAIL_VAR1="string1" +ROUGAIL_VAR2="string1" +ROUGAIL_VAR3="string1" diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all_exclude.env b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all_exclude.env new file mode 100644 index 0000000..000c6a3 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/all_exclude.env @@ -0,0 +1,3 @@ +ROUGAIL_VAR1="string1" +ROUGAIL_VAR2="string1" +ROUGAIL_VAR3="string1" diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/file/mandatories.env b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/mandatories.env new file mode 100644 index 0000000..c602362 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/file/mandatories.env @@ -0,0 +1,2 @@ +ROUGAIL_VAR1="string1" +ROUGAIL_VAR3="string1" diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/all.json b/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/all.json new file mode 100644 index 0000000..c1ddfdc --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/all.json @@ -0,0 +1,5 @@ +{ + "var1": "string1", + "var2": "string1", + "var3": "string1" +} diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json b/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json new file mode 100644 index 0000000..c1ddfdc --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json @@ -0,0 +1,5 @@ +{ + "var1": "string1", + "var2": "string1", + "var3": "string1" +} diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/errors/all.json b/tests/results/test/44_4disabled_calcultion_follower_index/errors/all.json new file mode 100644 index 0000000..262f1d2 --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/errors/all.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"leadership.follower\" (a follower) at index \"0\" is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/errors/mandatories.json b/tests/results/test/44_4disabled_calcultion_follower_index/errors/mandatories.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/errors/mandatories.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/file/all.env b/tests/results/test/44_4disabled_calcultion_follower_index/file/all.env new file mode 100644 index 0000000..23c1376 --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/file/all.env @@ -0,0 +1,2 @@ +ROUGAIL_LEADERSHIP.LEADER="string1,string2,string3" +ROUGAIL_LEADERSHIP.FOLLOWER="string1,string2,string3" diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/file/all_exclude.env b/tests/results/test/44_4disabled_calcultion_follower_index/file/all_exclude.env new file mode 100644 index 0000000..23c1376 --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/file/all_exclude.env @@ -0,0 +1,2 @@ +ROUGAIL_LEADERSHIP.LEADER="string1,string2,string3" +ROUGAIL_LEADERSHIP.FOLLOWER="string1,string2,string3" diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/file/mandatories.env b/tests/results/test/44_4disabled_calcultion_follower_index/file/mandatories.env new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/file/mandatories.env @@ -0,0 +1 @@ + diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/makedict/all.json b/tests/results/test/44_4disabled_calcultion_follower_index/makedict/all.json new file mode 100644 index 0000000..ef754fc --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/makedict/all.json @@ -0,0 +1,15 @@ +{ + "leadership.leader": [ + { + "leadership.leader": "string1" + }, + { + "leadership.leader": "string2", + "leadership.follower": "string2" + }, + { + "leadership.leader": "string3", + "leadership.follower": "string3" + } + ] +} diff --git a/tests/results/test/44_4disabled_calcultion_follower_index/makedict/mandatories.json b/tests/results/test/44_4disabled_calcultion_follower_index/makedict/mandatories.json new file mode 100644 index 0000000..f10104b --- /dev/null +++ b/tests/results/test/44_4disabled_calcultion_follower_index/makedict/mandatories.json @@ -0,0 +1,11 @@ +{ + "leadership.leader": [ + { + "leadership.leader": "a" + }, + { + "leadership.leader": "b", + "leadership.follower": "value" + } + ] +} diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/all.json b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/all.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/all.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/mandatories.json b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/mandatories.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/errors/mandatories.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all.env b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all.env new file mode 100644 index 0000000..ad10096 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all.env @@ -0,0 +1,3 @@ +ROUGAIL.VAR1="string1" +ROUGAIL.VAR2="string1" +ROUGAIL.VAR3="string1" diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all_exclude.env b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all_exclude.env new file mode 100644 index 0000000..ad10096 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/all_exclude.env @@ -0,0 +1,3 @@ +ROUGAIL.VAR1="string1" +ROUGAIL.VAR2="string1" +ROUGAIL.VAR3="string1" diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/mandatories.env b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/mandatories.env new file mode 100644 index 0000000..764a624 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/file/mandatories.env @@ -0,0 +1,2 @@ +ROUGAIL.VAR1="string1" +ROUGAIL.VAR3="string1" diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/all.json b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/all.json new file mode 100644 index 0000000..2fbf52f --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/all.json @@ -0,0 +1,5 @@ +{ + "rougail.var1": "string1", + "rougail.var2": "string1", + "rougail.var3": "string1" +} diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json new file mode 100644 index 0000000..2fbf52f --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line/makedict/mandatories.json @@ -0,0 +1,5 @@ +{ + "rougail.var1": "string1", + "rougail.var2": "string1", + "rougail.var3": "string1" +} diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/all.json b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/all.json new file mode 100644 index 0000000..bea2eea --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/all.json @@ -0,0 +1,6 @@ +{ + "errors": [], + "warnings": [ + "variable \"rougail.leadership.follower\" (a follower) at index \"0\" is disabled, it will be ignored when loading from environment variable" + ] +} \ No newline at end of file diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/mandatories.json b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/mandatories.json new file mode 100644 index 0000000..217db0a --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/errors/mandatories.json @@ -0,0 +1,4 @@ +{ + "errors": [], + "warnings": [] +} \ No newline at end of file diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all.env b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all.env new file mode 100644 index 0000000..7a4f851 --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all.env @@ -0,0 +1,2 @@ +ROUGAIL.LEADERSHIP.LEADER="string1,string2,string3" +ROUGAIL.LEADERSHIP.FOLLOWER="string1,string2,string3" diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all_exclude.env b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all_exclude.env new file mode 100644 index 0000000..7a4f851 --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/all_exclude.env @@ -0,0 +1,2 @@ +ROUGAIL.LEADERSHIP.LEADER="string1,string2,string3" +ROUGAIL.LEADERSHIP.FOLLOWER="string1,string2,string3" diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/mandatories.env b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/mandatories.env new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/file/mandatories.env @@ -0,0 +1 @@ + diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/all.json b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/all.json new file mode 100644 index 0000000..115f1e1 --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/all.json @@ -0,0 +1,15 @@ +{ + "rougail.leadership.leader": [ + { + "rougail.leadership.leader": "string1" + }, + { + "rougail.leadership.leader": "string2", + "rougail.leadership.follower": "string2" + }, + { + "rougail.leadership.leader": "string3", + "rougail.leadership.follower": "string3" + } + ] +} diff --git a/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/mandatories.json b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/mandatories.json new file mode 100644 index 0000000..19cc323 --- /dev/null +++ b/tests/results/test_namespace/44_4disabled_calcultion_follower_index/makedict/mandatories.json @@ -0,0 +1,11 @@ +{ + "rougail.leadership.leader": [ + { + "rougail.leadership.leader": "a" + }, + { + "rougail.leadership.leader": "b", + "rougail.leadership.follower": "value" + } + ] +} diff --git a/tests/test_load.py b/tests/test_load.py index 3e3cff4..b6b59a9 100644 --- a/tests/test_load.py +++ b/tests/test_load.py @@ -33,7 +33,7 @@ def test_dir(request): return request.param -def _test_dictionaries(test_dir, namespace, ext, *, level, need_exclude=False): +def _test_structural_files(test_dir, namespace, ext, *, level, need_exclude=False): rougailconfig = get_rougail_config(test_dir, namespace) if not rougailconfig: return @@ -173,34 +173,34 @@ def convert_str(val): ############################################## -def test_dictionaries_all(test_dir): +def test_structural_files_all(test_dir): "tests the output" - _test_dictionaries(test_dir, False, EXT, level='all') + _test_structural_files(test_dir, False, EXT, level='all') -def test_dictionaries_all_exclude(test_dir): +def test_structural_files_all_exclude(test_dir): "tests the output" - _test_dictionaries(test_dir, False, EXT, level='all', need_exclude=True) + _test_structural_files(test_dir, False, EXT, level='all', need_exclude=True) -def test_dictionaries_mandatories(test_dir): +def test_structural_files_mandatories(test_dir): "tests the output" - _test_dictionaries(test_dir, False, EXT, level='mandatories') + _test_structural_files(test_dir, False, EXT, level='mandatories') -def test_dictionaries_namespace_all(test_dir): +def test_structural_files_namespace_all(test_dir): "tests the output" - _test_dictionaries(test_dir, True, EXT, level='all') + _test_structural_files(test_dir, True, EXT, level='all') -def test_dictionaries_namespace_all_exclude(test_dir): +def test_structural_files_namespace_all_exclude(test_dir): "tests the output" - _test_dictionaries(test_dir, True, EXT, level='all', need_exclude=True) + _test_structural_files(test_dir, True, EXT, level='all', need_exclude=True) -def test_dictionaries_namespace_mandatories(test_dir): +def test_structural_files_namespace_mandatories(test_dir): "tests the output" - _test_dictionaries(test_dir, True, EXT, level='mandatories') + _test_structural_files(test_dir, True, EXT, level='mandatories') ####################################################################### @@ -213,7 +213,7 @@ def test_file_error(request): return request.param -def test_dictionaries_error(test_file_error): +def test_structural_files_error(test_file_error): rougailconfig = get_rougail_config(test_file_error.parent.parent / 'structure') ################################## rougailconfig['step.user_data'] = ['environment']