feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -13,26 +13,26 @@ func TestErrorLogGroupProjection(t *testing.T) {
|
||||
{"root", FormatRootLogs}, {"admin", FormatAdminLogs}, {"user", func(logs []*Log) { formatUserLogs(logs, 0) }},
|
||||
} {
|
||||
t.Run(format.name, func(t *testing.T) {
|
||||
metadata := `{"admin_info":{"request_policy":[{"channel_id":101,"group":"example-primary"},{"channel_id":102,"group":"example-preferred"}],"private":"secret"},"root_info":{"private":"secret"}}`
|
||||
metadata := `{"admin_info":{"request_policy":[{"channel_id":1,"group":"test-group-a"},{"channel_id":27,"group":"test-group-b"}],"private":"secret"},"root_info":{"private":"secret"}}`
|
||||
logs := []*Log{
|
||||
{Type: LogTypeError, ChannelId: 102, Group: "default", Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 101, Group: "default", Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 27, Group: "default", Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 1, Group: "default", Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 0, Group: "default", Other: metadata},
|
||||
{Type: LogTypeConsume, ChannelId: 102, Group: "billed-group", Quota: 12345, Other: metadata},
|
||||
{Type: LogTypeConsume, ChannelId: 27, Group: "billed-group", Quota: 799463, Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 99, Group: "legacy", Other: metadata},
|
||||
{Type: LogTypeError, ChannelId: 102, Group: "legacy", Other: `invalid`},
|
||||
{Type: LogTypeError, ChannelId: 27, Group: "legacy", Other: `invalid`},
|
||||
}
|
||||
format.fn(logs)
|
||||
for i, want := range []string{"example-preferred", "example-primary", "", "billed-group", "legacy", "legacy"} {
|
||||
for i, want := range []string{"test-group-b", "test-group-a", "", "billed-group", "legacy", "legacy"} {
|
||||
require.Equal(t, want, logs[i].Group)
|
||||
}
|
||||
require.Equal(t, 12345, logs[3].Quota)
|
||||
require.Equal(t, 799463, logs[3].Quota)
|
||||
if format.name == "user" {
|
||||
require.NotContains(t, logs[0].Other, "secret")
|
||||
require.NotContains(t, logs[0].Other, "request_policy")
|
||||
}
|
||||
format.fn(logs)
|
||||
require.Equal(t, "example-preferred", logs[0].Group)
|
||||
require.Equal(t, "test-group-b", logs[0].Group)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user