Add unit test for alternate order
Ensure that any alternates for YADM_CONFIG are processed prior to templates.
This commit is contained in:
parent
b056051603
commit
87f81143b2
1 changed files with 27 additions and 0 deletions
|
@ -112,3 +112,30 @@ def test_existing_template(runner, yadm):
|
|||
assert 'SCORES:1\n' in run.out
|
||||
assert 'TARGETS:testtgt\n' in run.out
|
||||
assert 'SOURCES:\n' in run.out
|
||||
|
||||
|
||||
def test_config_first(runner, yadm):
|
||||
"""Verify YADM_CONFIG is always processed first"""
|
||||
|
||||
config = 'yadm_config_file'
|
||||
script = f"""
|
||||
YADM_TEST=1 source {yadm}
|
||||
{INIT_VARS}
|
||||
YADM_CONFIG={config}
|
||||
record_score "1" "tgt_before" "src_before"
|
||||
record_template "tgt_tmp" "cmd_tmp" "src_tmp"
|
||||
record_score "2" "{config}" "src_config"
|
||||
record_score "3" "tgt_after" "src_after"
|
||||
{REPORT_RESULTS}
|
||||
echo "CMD_VALUE:${{alt_template_cmds[@]}}"
|
||||
echo "CMD_INDEX:${{!alt_template_cmds[@]}}"
|
||||
"""
|
||||
run = runner(command=['bash'], inp=script)
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert 'SIZE:3\n' in run.out
|
||||
assert 'SCORES:2 1 3\n' in run.out
|
||||
assert f'TARGETS:{config} tgt_before tgt_tmp tgt_after\n' in run.out
|
||||
assert 'SOURCES:src_config src_before src_tmp src_after\n' in run.out
|
||||
assert 'CMD_VALUE:cmd_tmp\n' in run.out
|
||||
assert 'CMD_INDEX:2\n' in run.out
|
||||
|
|
Loading…
Reference in a new issue