mirror of https://github.com/docker/docs.git
fix unit test and add integration test
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
a59f3578ee
commit
967a98d40f
|
|
@ -126,19 +126,19 @@ func TestImagesFilterWithNameFilterWithTag(t *testing.T) {
|
|||
|
||||
func TestParseRepositoryTag(t *testing.T) {
|
||||
|
||||
repo, tag := parseRepositoryTag("localhost.localdomain:5000/samalba/hipache:latest")
|
||||
repo, tag := ParseRepositoryTag("localhost.localdomain:5000/samalba/hipache:latest")
|
||||
if tag != "latest" {
|
||||
t.Errorf("repo=%s tag=%s", repo, tag)
|
||||
}
|
||||
repo, tag = parseRepositoryTag("localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb")
|
||||
repo, tag = ParseRepositoryTag("localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb")
|
||||
if tag != "sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb" {
|
||||
t.Logf("repo=%s tag=%s", repo, tag)
|
||||
}
|
||||
repo, tag = parseRepositoryTag("localhost:5000/foo/bar")
|
||||
repo, tag = ParseRepositoryTag("localhost:5000/foo/bar")
|
||||
if tag != "" {
|
||||
t.Logf("repo=%s tag=%s", repo, tag)
|
||||
}
|
||||
repo, tag = parseRepositoryTag("localhost:5000/foo/bar:latest")
|
||||
repo, tag = ParseRepositoryTag("localhost:5000/foo/bar:latest")
|
||||
t.Logf("repo=%s tag=%s", repo, tag)
|
||||
if tag != "latest" {
|
||||
t.Logf("repo=%s tag=%s", repo, tag)
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
|
||||
run docker_swarm inspect c1
|
||||
# FIXME: This will help debugging the failing test.
|
||||
echo $output
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *'"Name": "node-1"'* ]]
|
||||
|
||||
|
|
@ -86,6 +84,26 @@ function teardown() {
|
|||
[[ "${output}" != *'"Name": "node-1"'* ]]
|
||||
}
|
||||
|
||||
@test "images affinity - local registry" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
# Create a new image just on the second host.
|
||||
run docker -H ${HOSTS[1]} tag busybox localhost:5000/test
|
||||
|
||||
# pull busybox to force the refresh images
|
||||
# FIXME: this is slow.
|
||||
run docker_swarm pull busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run docker_swarm run --name c1 -e affinity:image==localhost:5000/test -d busybox:latest sh
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run docker_swarm inspect c1
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *'"Name": "node-1"'* ]]
|
||||
}
|
||||
|
||||
@test "label affinity" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
|
|
|||
Loading…
Reference in New Issue