(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestAuditor(t *testing.T) { |
| 17 | t.Parallel() |
| 18 | |
| 19 | tests := []struct { |
| 20 | name string |
| 21 | filterDecision audit.FilterDecision |
| 22 | filterError error |
| 23 | backendDecision audit.FilterDecision |
| 24 | backendError error |
| 25 | shouldExport bool |
| 26 | }{ |
| 27 | { |
| 28 | name: "ShouldDrop", |
| 29 | filterDecision: audit.FilterDecisionDrop, |
| 30 | backendDecision: audit.FilterDecisionStore, |
| 31 | shouldExport: false, |
| 32 | }, |
| 33 | { |
| 34 | name: "ShouldStore", |
| 35 | filterDecision: audit.FilterDecisionStore, |
| 36 | backendDecision: audit.FilterDecisionStore, |
| 37 | shouldExport: true, |
| 38 | }, |
| 39 | { |
| 40 | name: "ShouldNotStore", |
| 41 | filterDecision: audit.FilterDecisionExport, |
| 42 | backendDecision: audit.FilterDecisionStore, |
| 43 | shouldExport: false, |
| 44 | }, |
| 45 | { |
| 46 | name: "ShouldExport", |
| 47 | filterDecision: audit.FilterDecisionExport, |
| 48 | backendDecision: audit.FilterDecisionExport, |
| 49 | shouldExport: true, |
| 50 | }, |
| 51 | { |
| 52 | name: "ShouldNotExport", |
| 53 | filterDecision: audit.FilterDecisionStore, |
| 54 | backendDecision: audit.FilterDecisionExport, |
| 55 | shouldExport: false, |
| 56 | }, |
| 57 | { |
| 58 | name: "ShouldStoreOrExport", |
| 59 | filterDecision: audit.FilterDecisionStore | audit.FilterDecisionExport, |
| 60 | backendDecision: audit.FilterDecisionExport, |
| 61 | shouldExport: true, |
| 62 | }, |
| 63 | { |
| 64 | name: "FilterError", |
| 65 | filterError: xerrors.New("filter errored"), |
| 66 | backendDecision: audit.FilterDecisionExport, |
| 67 | shouldExport: false, |
| 68 | }, |
| 69 | { |
| 70 | name: "BackendError", |
| 71 | backendError: xerrors.New("backend errored"), |
| 72 | shouldExport: false, |
| 73 | }, |
nothing calls this directly
no test coverage detected