mirror of
https://github.com/GNS3/gns3-server
synced 2025-07-15 02:58:34 +00:00
Fix Docker tests
This commit is contained in:
parent
3fb138b9a1
commit
f347e21100
@ -103,9 +103,18 @@ async def test_create(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -144,9 +153,18 @@ async def test_create_with_tag(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -188,10 +206,23 @@ async def test_create_vnc(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
'/tmp/.X11-unix/:/tmp/.X11-unix/'
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": "/tmp/.X11-unix/",
|
||||||
|
"Target": "/tmp/.X11-unix/"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -310,9 +341,18 @@ async def test_create_start_cmd(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -413,9 +453,18 @@ async def test_create_image_not_available(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -459,9 +508,18 @@ async def test_create_with_user(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -548,10 +606,23 @@ async def test_create_with_extra_volumes_duplicate_1_image(compute_project, mana
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes/vol/1".format(os.path.join(vm.working_dir, "vol", "1")),
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol", "1"),
|
||||||
|
"Target": "/gns3volumes/vol/1"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -590,10 +661,23 @@ async def test_create_with_extra_volumes_duplicate_2_user(compute_project, manag
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes/vol/1".format(os.path.join(vm.working_dir, "vol", "1")),
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol", "1"),
|
||||||
|
"Target": "/gns3volumes/vol/1"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -632,10 +716,23 @@ async def test_create_with_extra_volumes_duplicate_3_subdir(compute_project, man
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes/vol".format(os.path.join(vm.working_dir, "vol")),
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol"),
|
||||||
|
"Target": "/gns3volumes/vol"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -674,10 +771,23 @@ async def test_create_with_extra_volumes_duplicate_4_backslash(compute_project,
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes/vol".format(os.path.join(vm.working_dir, "vol")),
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol"),
|
||||||
|
"Target": "/gns3volumes/vol"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -716,9 +826,18 @@ async def test_create_with_extra_volumes_duplicate_5_subdir_issue_1595(compute_p
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc".format(os.path.join(vm.working_dir, "etc")),
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc"),
|
||||||
|
"Target": "/gns3volumes/etc"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -757,9 +876,18 @@ async def test_create_with_extra_volumes_duplicate_6_subdir_issue_1595(compute_p
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc".format(os.path.join(vm.working_dir, "etc")),
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc"),
|
||||||
|
"Target": "/gns3volumes/etc"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -804,11 +932,28 @@ async def test_create_with_extra_volumes(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes/vol/1".format(os.path.join(vm.working_dir, "vol", "1")),
|
"Source": get_resource("compute/docker/resources"),
|
||||||
"{}:/gns3volumes/vol/2".format(os.path.join(vm.working_dir, "vol", "2")),
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol", "1"),
|
||||||
|
"Target": "/gns3volumes/vol/1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "vol", "2"),
|
||||||
|
"Target": "/gns3volumes/vol/2"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -1043,9 +1188,18 @@ async def test_update(vm):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -1115,9 +1269,18 @@ async def test_update_running(vm):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -1397,9 +1560,22 @@ async def test_mount_binds(vm):
|
|||||||
|
|
||||||
dst = os.path.join(vm.working_dir, "test/experimental")
|
dst = os.path.join(vm.working_dir, "test/experimental")
|
||||||
assert vm._mount_binds(image_infos) == [
|
assert vm._mount_binds(image_infos) == [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network")),
|
"Type": "bind",
|
||||||
"{}:/gns3volumes{}".format(dst, "/test/experimental")
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": dst,
|
||||||
|
"Target": "/gns3volumes/test/experimental"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
assert vm._volumes == ["/etc/network", "/test/experimental"]
|
assert vm._volumes == ["/etc/network", "/test/experimental"]
|
||||||
@ -1527,9 +1703,18 @@ async def test_cpus(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 0,
|
"Memory": 0,
|
||||||
@ -1568,9 +1753,18 @@ async def test_memory(compute_project, manager):
|
|||||||
"HostConfig":
|
"HostConfig":
|
||||||
{
|
{
|
||||||
"CapAdd": ["ALL"],
|
"CapAdd": ["ALL"],
|
||||||
"Binds": [
|
"Mounts": [
|
||||||
"{}:/gns3:ro".format(get_resource("compute/docker/resources")),
|
{
|
||||||
"{}:/gns3volumes/etc/network".format(os.path.join(vm.working_dir, "etc", "network"))
|
"Type": "bind",
|
||||||
|
"Source": get_resource("compute/docker/resources"),
|
||||||
|
"Target": "/gns3",
|
||||||
|
"ReadOnly": True
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "bind",
|
||||||
|
"Source": os.path.join(vm.working_dir, "etc", "network"),
|
||||||
|
"Target": "/gns3volumes/etc/network"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"Privileged": True,
|
"Privileged": True,
|
||||||
"Memory": 33554432, # 32MB in bytes
|
"Memory": 33554432, # 32MB in bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user