Ejemplo n.º 1
0
def test_dereference_config_tree_no_evict():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES),
                                          evict_on_error=False)
    for cluster_name, ref_section, ref_name in [
        ('wrong_example_google', 'login', 'ubuntu'),
        ('wrong_example_google', 'setup', 'example_setup'),
    ]:
        assert (deref_tree['cluster'][cluster_name][ref_section] is
                deref_tree[ref_section][ref_name])
Ejemplo n.º 2
0
def test_dereference_config_tree_no_evict():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES),
                                          evict_on_error=False)
    for cluster_name, ref_section, ref_name in [
            ('example_google',       'login', 'ubuntu'),
            ('example_google',       'setup', 'example_setup'),
    ]:
        assert (deref_tree['cluster'][cluster_name][ref_section]
                is deref_tree[ref_section][ref_name])
Ejemplo n.º 3
0
def test_build_node_section():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    cfg = _build_node_section(deref_tree)['cluster']
    cluster_cfg = cfg['example_ec2']
    assert 'nodes' in cluster_cfg
    nodes_cfg = cluster_cfg['nodes']
    assert 'misc' in nodes_cfg
    assert nodes_cfg['misc']['flavor'] == 'm1.tiny'
    assert nodes_cfg['misc']['image_id'] == 'i-12345'
    assert nodes_cfg['misc']['num'] == 10
    assert nodes_cfg['misc']['min_num'] == 10
Ejemplo n.º 4
0
def test_build_node_section():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    cfg = _build_node_section(deref_tree)['cluster']
    cluster_cfg = cfg['example_ec2']
    assert 'nodes' in cluster_cfg
    nodes_cfg = cluster_cfg['nodes']
    assert 'misc' in nodes_cfg
    assert nodes_cfg['misc']['flavor'] == 'm1.tiny'
    assert nodes_cfg['misc']['image_id'] == 'i-12345'
    assert nodes_cfg['misc']['num'] == 10
    assert nodes_cfg['misc']['min_num'] == 10
Ejemplo n.º 5
0
def test_build_node_section_google():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    cfg = _build_node_section(deref_tree)['cluster']
    cluster_cfg = cfg['example_google']
    assert 'nodes' in cluster_cfg
    nodes_cfg = cluster_cfg['nodes']
    assert 'misc' in nodes_cfg
    assert nodes_cfg['misc']['boot_disk_size'] == '15'
    assert nodes_cfg['misc']['boot_disk_type'] == 'pd-standard'
    assert nodes_cfg['misc']['scheduling'] == "preemptible"
    assert nodes_cfg['misc']['node_name'] == "my-node"
    assert nodes_cfg['misc']['tags'] == "tag1,tag2,tag3"
Ejemplo n.º 6
0
def test_build_node_section_google():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    cfg = _build_node_section(deref_tree)['cluster']
    cluster_cfg = cfg['example_google']
    assert 'nodes' in cluster_cfg
    nodes_cfg = cluster_cfg['nodes']
    assert 'misc' in nodes_cfg
    assert nodes_cfg['misc']['boot_disk_size'] == '15'
    assert nodes_cfg['misc']['boot_disk_type'] == 'pd-standard'
    assert nodes_cfg['misc']['scheduling'] == "preemptible"
    assert nodes_cfg['misc']['node_name'] == "my-node"
    assert 'tags' not in nodes_cfg['misc']
Ejemplo n.º 7
0
def test_dereference_config_tree_evict():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    for cluster_name, ref_section, ref_name in [
            ('example_ec2',          'cloud', 'ec2'),
            ('example_ec2',          'login', 'ubuntu'),
            ('example_ec2',          'setup', 'example_setup'),
            ('example_ec2_with_vpc', 'cloud', 'ec2'),
            ('example_ec2_with_vpc', 'login', 'ubuntu'),
            ('example_ec2_with_vpc', 'setup', 'example_setup'),
            ('example_openstack',    'cloud', 'openstack'),
            ('example_openstack',    'login', 'ubuntu'),
            ('example_openstack',    'setup', 'example_setup'),
    ]:
        assert isinstance(deref_tree['cluster'][cluster_name][ref_section],
                          collections.Mapping)
        assert (deref_tree['cluster'][cluster_name][ref_section]
                is deref_tree[ref_section][ref_name])
    # check eviction of clusters w/ wrong config
    assert 'example_google' not in deref_tree['cluster']
Ejemplo n.º 8
0
def test_dereference_config_tree_evict():
    deref_tree = _dereference_config_tree(deepcopy(CONFIG_TREE_WITH_RENAMES))
    for cluster_name, ref_section, ref_name in [
        ('example_ec2', 'cloud', 'ec2'),
        ('example_ec2', 'login', 'ubuntu'),
        ('example_ec2', 'setup', 'example_setup'),
        ('example_ec2_with_vpc', 'cloud', 'ec2'),
        ('example_ec2_with_vpc', 'login', 'ubuntu'),
        ('example_ec2_with_vpc', 'setup', 'example_setup'),
        ('example_openstack', 'cloud', 'openstack'),
        ('example_openstack', 'login', 'ubuntu'),
        ('example_openstack', 'setup', 'example_setup'),
    ]:
        assert isinstance(deref_tree['cluster'][cluster_name][ref_section],
                          collections.Mapping)
        assert (deref_tree['cluster'][cluster_name][ref_section] is
                deref_tree[ref_section][ref_name])
    # check eviction of clusters w/ wrong config
    assert 'example_google' not in deref_tree['cluster']