def test_get_num_terms_mix(): # Lab options have a greater priority than machine options lab = Lab('mem_test') lab.add_option("num_terms", "2") kwargs = {"num_terms": "1"} device1 = Machine(lab, "test_machine1", **kwargs) device2 = Machine(lab, "test_machine2") assert device1.get_num_terms() == 2 assert device2.get_num_terms() == 2
def default_device(mock_docker_container): device = Machine(Lab('Default scenario'), "test_device") device.add_meta("exec", "ls") device.add_meta("mem", "64m") device.add_meta("cpus", "2") device.add_meta("image", "kathara/test") device.add_meta("bridged", False) device.api_object = mock_docker_container return device
def default_device(mock_kubernetes_deployment): device = Machine(Lab("default_scenario"), "test_device") device.add_meta("exec", "ls") device.add_meta("mem", "64m") device.add_meta("cpus", "2") device.add_meta("image", "kathara/test") device.add_meta("bridged", False) device.add_meta('real_name', "devprefix-test-device-ec84ad3b") device.api_object = mock_kubernetes_deployment return device
def default_device(): return Machine(Lab("test_lab"), "test_machine")
def test_get_num_terms_from_device_meta(): kwargs = {"num_terms": "1"} device = Machine(Lab("test_lab"), "test_machine", **kwargs) assert device.get_num_terms() == 1
def test_get_num_terms_from_lab_options(): lab = Lab('mem_test') lab.add_option("num_terms", "2") device = Machine(lab, "test_machine") assert device.get_num_terms() == 2
def test_get_cpu_from_device_meta(): kwargs = {"cpus": "1"} device = Machine(Lab("test_lab"), "test_machine", **kwargs) assert device.get_cpu() == 1
def test_get_mem_from_device_meta(): kwargs = {"mem": "200m"} device = Machine(Lab("test_lab"), "test_machine", **kwargs) assert device.get_mem() == "200m"
def test_get_mem_from_lab_options(): lab = Lab('mem_test') lab.add_option("mem", "150m") device = Machine(lab, "test_machine") assert device.get_mem() == "150m"
def test_get_image(): kwargs = {'image': 'kathara/frr'} device = Machine(Lab("test_lab"), "test_machine", **kwargs) assert device.get_image() == "kathara/frr"