1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/logger/journald/journald_test.go
Sebastiaan van Stijn 686be57d0a
Update to Go 1.17.0, and gofmt with Go 1.17
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-24 23:33:27 +02:00

24 lines
724 B
Go

//go:build linux
// +build linux
package journald // import "github.com/docker/docker/daemon/logger/journald"
import (
"testing"
)
func TestSanitizeKeyMod(t *testing.T) {
entries := map[string]string{
"io.kubernetes.pod.name": "IO_KUBERNETES_POD_NAME",
"io?.kubernetes.pod.name": "IO__KUBERNETES_POD_NAME",
"?io.kubernetes.pod.name": "IO_KUBERNETES_POD_NAME",
"io123.kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME",
"_io123.kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME",
"__io123_kubernetes.pod.name": "IO123_KUBERNETES_POD_NAME",
}
for k, v := range entries {
if sanitizeKeyMod(k) != v {
t.Fatalf("Failed to sanitize %s, got %s, expected %s", k, sanitizeKeyMod(k), v)
}
}
}