If we don't have a GNS3 VM on linux don't move file to it

This commit is contained in:
Julien Duponchelle committed 2016-07-25 18:03:22 +02:00
1 parent f357879186
commit e50acf811c
4 files changed
+61 -5

No files matched your search

+7 -1
View File
@@ -192,6 +192,13 @@ def test_getCompute(controller, async_run):
assert controller.get_compute("dsdssd")
def test_has_compute(controller, async_run):
compute = async_run(controller.add_compute(compute_id="test1"))
assert controller.has_compute("test1")
assert not controller.has_compute("test2")
def test_initControllerLocal(controller, controller_config_path, async_run):
"""
The local node is the controller itself you can not change the informations
@@ -344,4 +351,3 @@ def test_get_free_project_name(controller, async_run):
async_run(controller.add_project(project_id=str(uuid.uuid4()), name="Test-1"))
assert controller.get_free_project_name("Test") == "Test-2"
assert controller.get_free_project_name("Hello") == "Hello"
+45 -2
View File
@@ -131,9 +131,9 @@ def test_import_with_images(tmpdir, async_run, controller):
assert os.path.exists(path), path
def test_import_iou_linux(linux_platform, async_run, tmpdir, controller):
def test_import_iou_linux_no_vm(linux_platform, async_run, tmpdir, controller):
"""
On non linux host IOU should be local
On non linux host IOU should be local if we don't have a GNS3 VM
"""
project_id = str(uuid.uuid4())
@@ -172,6 +172,49 @@ def test_import_iou_linux(linux_platform, async_run, tmpdir, controller):
assert topo["topology"]["nodes"][0]["compute_id"] == "local"
def test_import_iou_linux_with_vm(linux_platform, async_run, tmpdir, controller):
"""
On non linux host IOU should be vm if we have a GNS3 VM configured
"""
project_id = str(uuid.uuid4())
controller._computes["vm"] = AsyncioMagicMock()
topology = {
"project_id": str(uuid.uuid4()),
"name": "test",
"type": "topology",
"topology": {
"nodes": [
{
"compute_id": "local",
"node_id": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b",
"node_type": "iou",
"properties": {}
}
],
"links": [],
"computes": [],
"drawings": []
},
"revision": 5,
"version": "2.0.0"
}
with open(str(tmpdir / "project.gns3"), 'w+') as f:
json.dump(topology, f)
zip_path = str(tmpdir / "project.zip")
with zipfile.ZipFile(zip_path, 'w') as myzip:
myzip.write(str(tmpdir / "project.gns3"), "project.gns3")
with open(zip_path, "rb") as f:
project = async_run(import_project(controller, project_id, f))
with open(os.path.join(project.path, "test.gns3")) as f:
topo = json.load(f)
assert topo["topology"]["nodes"][0]["compute_id"] == "vm"
def test_import_iou_non_linux(windows_platform, async_run, tmpdir, controller):
"""
On non linux host IOU should be moved to the GNS3 VM