示例#1
0
def test_documentation_steps_overlay(config_files, monkeypatch):
    with open(config_files, "r") as main_file:
        parser = ConfigurationParser(main_file)
        documentation_steps = parser.get_ordered_path_items(
            "documentation_steps")
        assert len(documentation_steps) == 2
        expected_steps = ["10_first_step", "20_second_step"]
        for step, expected in zip(documentation_steps, expected_steps):
            name, path, parameters, raw_node = step
            assert name == expected
            if name == "20_second_step":
                value = parameters.get("edi_doc_include_packages")
                assert value == ['x', 'y', 'z']
                assert raw_node.get('output', {}).get('file') == 'foo.rst'
示例#2
0
def test_playbooks_overlay(config_files, monkeypatch):
    with open(config_files, "r") as main_file:
        parser = ConfigurationParser(main_file)
        playbooks = parser.get_ordered_path_items("playbooks")
        assert len(playbooks) == 3
        expected_playbooks = ["10_base_system", "20_networking", "30_foo"]
        for playbook, expected in zip(playbooks, expected_playbooks):
            name, path, extra_vars, _ = playbook
            assert name == expected
            if name == "10_base_system":
                value = extra_vars.get("kernel_package")
                assert value == "linux-image-amd64-rt"
                value = extra_vars.get("message")
                assert value == "some message"
            if name == "20_networking":
                assert path.endswith("playbooks/foo.yml")