feat(go): advance validation sidecar toward production
This commit is contained in:
parent
6a06eba255
commit
f85c2e831a
92 changed files with 8881 additions and 91 deletions
33
go-agent/internal/events/catalog_test.go
Normal file
33
go-agent/internal/events/catalog_test.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package events
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRuleCatalogCoversEveryPortedRule(t *testing.T) {
|
||||
records := RuleCatalog(DefaultExecRuleEngine())
|
||||
if len(records) != 21 {
|
||||
t.Fatalf("got %d rules, want 21", len(records))
|
||||
}
|
||||
sids := make([]int, 0, len(records))
|
||||
for _, record := range records {
|
||||
sids = append(sids, record["sid"].(int))
|
||||
}
|
||||
want := []int{
|
||||
100001, 100002, 100003, 100004,
|
||||
100060, 100061, 100062, 100063, 100064, 100065, 100066,
|
||||
100067, 100068, 100069, 100070, 100071, 100072, 100073,
|
||||
100076, 100077, 100078,
|
||||
}
|
||||
if !reflect.DeepEqual(sids, want) {
|
||||
t.Fatalf("unexpected catalog SIDs: %#v", sids)
|
||||
}
|
||||
capability := FindRule(records, 100077)
|
||||
conditions := capability["conditions"].(map[string]any)
|
||||
if _, ok := conditions["capabilities_any"]; !ok {
|
||||
t.Fatalf("capability conditions missing: %#v", capability)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue