Exemplo n.º 1
0
def test_write_nodes_api_sections_registers_sections_to_be_written(
        node: agent.Node, nodes_api_sections: Sequence[str],
        write_sections_mock):
    agent.write_nodes_api_sections("cluster",
                                   agent.AnnotationNonPatternOption.ignore_all,
                                   [node], Mock())
    assert list(write_sections_mock.call_args[0][0]) == nodes_api_sections
Exemplo n.º 2
0
def test_write_nodes_api_sections_maps_section_names_to_callables(
        node: agent.Node, nodes_api_sections: Sequence[str],
        write_sections_mock):
    agent.write_nodes_api_sections("cluster",
                                   agent.AnnotationNonPatternOption.ignore_all,
                                   [node], Mock())
    assert all(
        callable(write_sections_mock.call_args[0][0][section_name])
        for section_name in nodes_api_sections)
Exemplo n.º 3
0
def test_write_nodes_api_sections_calls_write_sections_for_each_node(
        new_node: Callable[[], agent.Node], cluster_nodes: int,
        write_sections_mock):
    agent.write_nodes_api_sections(
        "cluster",
        agent.AnnotationNonPatternOption.ignore_all,
        [new_node() for _ in range(cluster_nodes)],
        Mock(),
    )
    assert write_sections_mock.call_count == cluster_nodes
Exemplo n.º 4
0
def test_write_nodes_api_sections_calls_write_sections_for_each_node(
        new_node, cluster_nodes, write_sections_mock):
    agent_kube.write_nodes_api_sections(
        [new_node() for _ in range(cluster_nodes)], Mock())
    assert write_sections_mock.call_count == cluster_nodes
Exemplo n.º 5
0
def test_write_nodes_api_sections_maps_section_names_to_callables(
        node, nodes_api_sections, write_sections_mock):
    agent_kube.write_nodes_api_sections([node], Mock())
    assert all(
        callable(write_sections_mock.call_args[0][0][section_name])
        for section_name in nodes_api_sections)
Exemplo n.º 6
0
def test_write_nodes_api_sections_registers_sections_to_be_written(
        node, nodes_api_sections, write_sections_mock):
    agent_kube.write_nodes_api_sections([node], Mock())
    assert list(write_sections_mock.call_args[0][0]) == nodes_api_sections