mirror of https://github.com/docker/docs.git
Support 'docker update' command.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
parent
5cb6f218dd
commit
f42f5fa3d4
|
@ -70,6 +70,7 @@ var routes = map[string]map[string]handler{
|
||||||
"/containers/{name:.*}/restart": proxyContainerAndForceRefresh,
|
"/containers/{name:.*}/restart": proxyContainerAndForceRefresh,
|
||||||
"/containers/{name:.*}/start": proxyContainerAndForceRefresh,
|
"/containers/{name:.*}/start": proxyContainerAndForceRefresh,
|
||||||
"/containers/{name:.*}/stop": proxyContainerAndForceRefresh,
|
"/containers/{name:.*}/stop": proxyContainerAndForceRefresh,
|
||||||
|
"/containers/{name:.*}/update": proxyContainerAndForceRefresh,
|
||||||
"/containers/{name:.*}/wait": proxyContainerAndForceRefresh,
|
"/containers/{name:.*}/wait": proxyContainerAndForceRefresh,
|
||||||
"/containers/{name:.*}/resize": proxyContainer,
|
"/containers/{name:.*}/resize": proxyContainer,
|
||||||
"/containers/{name:.*}/attach": proxyHijack,
|
"/containers/{name:.*}/attach": proxyHijack,
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load ../helpers
|
||||||
|
|
||||||
|
function teardown() {
|
||||||
|
swarm_manage_cleanup
|
||||||
|
stop_docker
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "docker update" {
|
||||||
|
# docker update is introduced in docker 1.10, skip older version without update command
|
||||||
|
run docker help update
|
||||||
|
if [[ "${output}" != *"Usage: docker update"* ]]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
|
|
||||||
|
start_docker_with_busybox 1
|
||||||
|
swarm_manage
|
||||||
|
docker_swarm run -d --name test_container \
|
||||||
|
-m=10M \
|
||||||
|
--cpu-period=50000 \
|
||||||
|
--cpu-quota=25000 \
|
||||||
|
--blkio-weight=300 \
|
||||||
|
busybox sleep 100
|
||||||
|
|
||||||
|
run docker_swarm inspect test_container
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "${output}" == *"\"Memory\": 10485760"* ]]
|
||||||
|
[[ "${output}" == *"\"CpuPeriod\": 50000"* ]]
|
||||||
|
[[ "${output}" == *"\"CpuQuota\": 25000"* ]]
|
||||||
|
[[ "${output}" == *"\"BlkioWeight\": 300"* ]]
|
||||||
|
|
||||||
|
# validate docker info reflects the resource change
|
||||||
|
run docker_swarm info
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "${output}" == *"Reserved Memory: 10 MiB"* ]]
|
||||||
|
|
||||||
|
run docker_swarm update \
|
||||||
|
-m=100M \
|
||||||
|
--cpu-period=50000 \
|
||||||
|
--cpu-quota=5000 \
|
||||||
|
--blkio-weight=600 \
|
||||||
|
test_container
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
run docker_swarm inspect test_container
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "${output}" == *"\"Memory\": 104857600"* ]]
|
||||||
|
[[ "${output}" == *"\"CpuQuota\": 5000"* ]]
|
||||||
|
[[ "${output}" == *"\"BlkioWeight\": 600"* ]]
|
||||||
|
|
||||||
|
# validate docker info reflects the resource change
|
||||||
|
run docker_swarm info
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "${output}" == *"Reserved Memory: 100 MiB"* ]]
|
||||||
|
}
|
Loading…
Reference in New Issue