TestValidateScanConfig_ThresholdLadder: equal/inverted thresholds are rejected so a (0,0) PATCH can't collapse the review band into block-everything.
(t *testing.T)
| 70 | // TestValidateScanConfig_ThresholdLadder: equal/inverted thresholds are rejected so |
| 71 | // a (0,0) PATCH can't collapse the review band into block-everything. |
| 72 | func 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 | } |
nothing calls this directly
no test coverage detected