include db for gitea build
This commit is contained in:
1 parent
8de4a2e010
commit
645f923175
33 files changed
+1490
-150
No files matched your search
@@ -54,3 +54,24 @@ func TestBuildWithholdsLabelWithoutCompleteBaseline(t *testing.T) {
|
||||
t.Fatalf("short history must not be labelled: %+v", rows)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildLogicalRequestFeatures(t *testing.T) {
|
||||
at := time.Date(2026, 9, 19, 12, 0, 0, 0, time.UTC)
|
||||
mk := func(client string, dup bool, class string) Event {
|
||||
return Event{Timestamp: at, Service: "nginx", Kind: "span", IsError: true, PatternSignature: "p", ClientIP: client, IsDuplicate: dup, UAClass: class}
|
||||
}
|
||||
rows := Build([]Event{mk("a", false, "ai_crawler"), mk("a", true, "ai_crawler"), mk("a", false, "browser"), mk("b", false, "browser")}, Config{})
|
||||
if len(rows) == 0 {
|
||||
t.Fatal("no rows")
|
||||
}
|
||||
r := rows[0]
|
||||
if r.ErrorCount != 4 || r.DuplicateErrors != 1 || r.LogicalErrors != 3 {
|
||||
t.Fatalf("logical errors wrong: %+v", r)
|
||||
}
|
||||
if r.DistinctClients != 2 || r.TopClientShare < 0.66 || r.TopClientShare > 0.67 {
|
||||
t.Fatalf("client features wrong: %+v", r)
|
||||
}
|
||||
if r.BotErrorShare < 0.33 || r.BotErrorShare > 0.34 {
|
||||
t.Fatalf("bot share wrong: %v", r.BotErrorShare)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user