diff --git a/test/integration/api/create.bats b/test/integration/api/create.bats index 83136d70b9..f5eff61ee4 100644 --- a/test/integration/api/create.bats +++ b/test/integration/api/create.bats @@ -16,11 +16,21 @@ function teardown() { [ "${#lines[@]}" -eq 0 ] # create - run docker_swarm create --name test_container busybox sleep 1000 - [ "$status" -eq 0 ] + docker_swarm create --name test_container busybox sleep 1000 # verify, created container exists run docker_swarm ps -l [ "${#lines[@]}" -eq 2 ] [[ "${lines[1]}" == *"test_container"* ]] } + +@test "docker create conflict" { + start_docker_with_busybox 1 + swarm_manage + + id=$(docker_swarm create busybox) + prefix=$(printf "$id" | cut -c 1-4) + docker_swarm create --name "$prefix" busybox + docker_swarm create --name "$id" busybox + docker_swarm create --name test busybox +} \ No newline at end of file diff --git a/test/integration/api/rename.bats b/test/integration/api/rename.bats index c0f715360d..225bc90747 100644 --- a/test/integration/api/rename.bats +++ b/test/integration/api/rename.bats @@ -11,11 +11,9 @@ function teardown() { start_docker_with_busybox 2 swarm_manage - run docker_swarm run -d --name test_container busybox sleep 500 - [ "$status" -eq 0 ] + docker_swarm run -d --name test_container busybox sleep 500 - run docker_swarm run -d --name another_container busybox sleep 500 - [ "$status" -eq 0 ] + docker_swarm run -d --name another_container busybox sleep 500 # make sure container exist run docker_swarm ps -a @@ -30,8 +28,7 @@ function teardown() { [[ "${output}" == *"Conflict,"* ]] # rename container, sucessful - run docker_swarm rename test_container rename_container - [ "$status" -eq 0 ] + docker_swarm rename test_container rename_container # verify after, rename run docker_swarm ps -a @@ -40,3 +37,15 @@ function teardown() { [[ "${output}" == *"another_container"* ]] [[ "${output}" != *"test_container"* ]] } + +@test "docker rename conflict" { + start_docker_with_busybox 1 + swarm_manage + + id=$(docker_swarm create busybox) + prefix=$(printf "$id" | cut -c 1-4) + docker_swarm create --name test busybox + docker_swarm rename test "$prefix" + run docker_swarm rename test "$id" + [ "$status" -eq 1 ] +} \ No newline at end of file