Beispiel #1
0
def test_JelasticEnvironment_nodes():
    """
    JelasticEnvironment can be instantiated with nodes
    """
    nodes = []
    for i in range(3):
        node = get_standard_node()
        node["id"] = i
        nodes.append(node)

    jelenv = JelasticEnvironment()
    jelenv.update_from_env_dict(get_standard_env())
    jelenv.update_node_groups_from_info(get_standard_node_groups())
    jelenv.update_nodes_from_info(nodes)

    assert not jelenv.differs_from_api()
    jelenv.nodeGroups["cp"].nodes[0].fixedCloudlets = 8
    assert jelenv.differs_from_api()

    jelapic()._ = Mock(return_value={
        "env": get_standard_env(),
        "envGroups": [],
        "nodes": [get_standard_node()],
    }, )
    jelenv.save()
    assert not jelenv.differs_from_api()
Beispiel #2
0
def test_JelasticEnvironment_differs_from_api_if_envGroups_is_changed():
    """
    JelasticEnvironment can be instantiated, but some read-only attributes can be read, but not written
    """
    jelenv = JelasticEnvironment()
    jelenv.update_from_env_dict(get_standard_env())
    jelenv.update_env_groups_from_info(["A", "B"])

    jelenv.envGroups.append("C")
    assert jelenv.differs_from_api()
    jelenv.envGroups = ["A", "B"]
    assert not jelenv.differs_from_api()
    jelenv.envGroups.remove("A")
    assert jelenv.differs_from_api()