gopkg.in/dotcloud/docker.v1@v1.13.1/daemon/logger/journald/journald_test.go (about) 1 // +build linux 2 3 package journald 4 5 import ( 6 "testing" 7 ) 8 9 func TestSanitizeKeyMod(t *testing.T) { 10 entries := map[string]string{ 11 "io.kubernetes.pod.name": "IO_KUBERNETES_POD_NAME", 12 "io?.kubernetes.pod.name": "IO__KUBERNETES_POD_NAME", 13 "?io.kubernetes.pod.name": "IO_KUBERNETES_POD_NAME", 14 "io123.kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME", 15 "_io123.kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME", 16 "__io123_kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME", 17 } 18 for k, v := range entries { 19 if sanitizeKeyMod(k) != v { 20 t.Fatalf("Failed to sanitize %s, got %s, expected %s", k, sanitizeKeyMod(k), v) 21 } 22 } 23 }