ab35df454d
Removed pre-go1.17 build-tags with go fix; go mod init go fix -mod=readonly ./... rm go.mod Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
23 lines
708 B
Go
23 lines
708 B
Go
//go: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)
|
|
}
|
|
}
|
|
}
|