1
0
mirror of https://github.com/docker/cli.git synced 2025-08-30 12:01:10 +03:00
Files
cli/kubernetes/labels/labels_test.go
Vincent Demeester 2c4de4fb5e Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 18:24:26 +02:00

24 lines
871 B
Go

package labels
import (
"testing"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
func TestForService(t *testing.T) {
labels := ForService("stack", "service")
assert.Check(t, is.Len(labels, 3))
assert.Check(t, is.Equal("stack", labels["com.docker.stack.namespace"]))
assert.Check(t, is.Equal("service", labels["com.docker.service.name"]))
assert.Check(t, is.Equal("stack-service", labels["com.docker.service.id"]))
}
func TestSelectorForStack(t *testing.T) {
assert.Check(t, is.Equal("com.docker.stack.namespace=demostack", SelectorForStack("demostack")))
assert.Check(t, is.Equal("com.docker.stack.namespace=stack,com.docker.service.name=service", SelectorForStack("stack", "service")))
assert.Check(t, is.Equal("com.docker.stack.namespace=stack,com.docker.service.name in (service1,service2)", SelectorForStack("stack", "service1", "service2")))
}