mirror of https://github.com/docker/docs.git
integration tests for resource limitation
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
parent
7e4cde9d08
commit
74592b8462
|
@ -32,14 +32,3 @@ function teardown() {
|
|||
# verify, container is running
|
||||
[ -n $(docker_swarm ps -q --filter=name=test_container --filter=status=running) ]
|
||||
}
|
||||
|
||||
@test "docker run not enough resources" {
|
||||
start_docker_with_busybox 1
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d --name test_container -m 1000g busybox ls
|
||||
[ "$status" -ne 0 ]
|
||||
|
||||
run docker_swarm run -d --name test_container -c 1000 busybox ls
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load helpers
|
||||
|
||||
function teardown() {
|
||||
swarm_manage_cleanup
|
||||
stop_docker
|
||||
}
|
||||
|
||||
@test "resource limitation: memory" {
|
||||
start_docker_with_busybox 1
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -m 1000G busybox sh
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "${lines[0]}" == *"no resources available to schedule container"* ]]
|
||||
|
||||
# The number of running containers should be still 0.
|
||||
run docker_swarm ps -n 2
|
||||
[ "${#lines[@]}" -eq 1 ]
|
||||
|
||||
# Node is still 1
|
||||
run docker_swarm info
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"Nodes: 1"* ]]
|
||||
}
|
||||
|
||||
@test "resource limitation: cpu" {
|
||||
start_docker_with_busybox 1
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -c 10240 busybox sh
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "${lines[0]}" == *"no resources available to schedule container"* ]]
|
||||
|
||||
# The number of running containers should be still 0.
|
||||
run docker_swarm ps -n 2
|
||||
[ "${#lines[@]}" -eq 1 ]
|
||||
|
||||
# Node is still 1
|
||||
run docker_swarm info
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"Nodes: 1"* ]]
|
||||
}
|
Loading…
Reference in New Issue