MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestValidateScanConfig_ThresholdLadder

Function TestValidateScanConfig_ThresholdLadder

internal/identity/held_guard_test.go:72–97  ·  view source on GitHub ↗

TestValidateScanConfig_ThresholdLadder: equal/inverted thresholds are rejected so a (0,0) PATCH can't collapse the review band into block-everything.

(t *testing.T)

Source from the content-addressed store, hash-verified

70// TestValidateScanConfig_ThresholdLadder: equal/inverted thresholds are rejected so
71// a (0,0) PATCH can't collapse the review band into block-everything.
72func TestValidateScanConfig_ThresholdLadder(t *testing.T) {
73 base := identity.ScanConfig{
74 InboundPolicyAction: identity.ScanActionFlag,
75 OutboundPolicy: identity.OutboundPolicyOpen, OutboundPolicyAction: identity.ScanActionFlag,
76 InboundScan: identity.ScanOn, OutboundScan: identity.ScanOn,
77 InboundScanReviewThreshold: 0.5, InboundScanBlockThreshold: 0.9,
78 OutboundScanReviewThreshold: 0.5, OutboundScanBlockThreshold: 0.9,
79 }
80 if err := identity.ValidateScanConfig(base); err != nil {
81 t.Fatalf("valid ladder rejected: %v", err)
82 }
83 for _, tc := range []struct {
84 name string
85 review, block float64
86 }{
87 {"equal zero", 0, 0},
88 {"equal mid", 0.5, 0.5},
89 {"inverted", 0.9, 0.2},
90 } {
91 c := base
92 c.OutboundScanReviewThreshold, c.OutboundScanBlockThreshold = tc.review, tc.block
93 if err := identity.ValidateScanConfig(c); err == nil {
94 t.Errorf("%s: (%v,%v) accepted, want rejected", tc.name, tc.review, tc.block)
95 }
96 }
97}

Callers

nothing calls this directly

Calls 1

ValidateScanConfigFunction · 0.92

Tested by

no test coverage detected