prysm-pulse/monitoring/journald/journalhook_linux_test.go
2023-04-17 20:43:40 +00:00

28 lines
612 B
Go

package journald
import "testing"
func TestStringifyEntries(t *testing.T) {
input := map[string]interface{}{
"foo": "bar",
"baz": 123,
"foo-foo": "x",
"-bar": "1",
}
output := stringifyEntries(input)
if output["FOO"] != "bar" {
t.Fatalf("%v", output)
t.Fatalf("expected value 'bar'. Got %q", output["FOO"])
}
if output["BAZ"] != "123" {
t.Fatalf("expected value '123'. Got %q", output["BAZ"])
}
if output["FOO_FOO"] != "x" {
t.Fatalf("expected value 'x'. Got %q", output["FOO_FOO"])
}
if output["BAR"] != "1" {
t.Fatalf("expected value 'x'. Got %q", output["BAR"])
}
}