Merge pull request #37215 from adshmh/integration-container-links-tests-use-unique-names

container links integration tests use unique names
This commit is contained in:
Vincent Demeester 2018-06-07 22:34:12 +02:00 committed by GitHub
commit d47c45175b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,15 +41,17 @@ func TestLinksContainerNames(t *testing.T) {
client := request.NewAPIClient(t)
ctx := context.Background()
container.Run(t, ctx, client, container.WithName("first"))
container.Run(t, ctx, client, container.WithName("second"), container.WithLinks("first:first"))
containerA := "first_" + t.Name()
containerB := "second_" + t.Name()
container.Run(t, ctx, client, container.WithName(containerA))
container.Run(t, ctx, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
f := filters.NewArgs(filters.Arg("name", "first"))
f := filters.NewArgs(filters.Arg("name", containerA))
containers, err := client.ContainerList(ctx, types.ContainerListOptions{
Filters: f,
})
assert.NilError(t, err)
assert.Check(t, is.Equal(1, len(containers)))
assert.Check(t, is.DeepEqual([]string{"/first", "/second/first"}, containers[0].Names))
assert.Check(t, is.DeepEqual([]string{"/" + containerA, "/" + containerB + "/" + containerA}, containers[0].Names))
}