(t *testing.T)
| 41 | } |
| 42 | |
| 43 | func (s) TestSPIFFEIDFromState(t *testing.T) { |
| 44 | tests := []struct { |
| 45 | name string |
| 46 | urls []*url.URL |
| 47 | // If we expect a SPIFFE ID to be returned. |
| 48 | wantID bool |
| 49 | }{ |
| 50 | { |
| 51 | name: "empty URIs", |
| 52 | urls: []*url.URL{}, |
| 53 | wantID: false, |
| 54 | }, |
| 55 | { |
| 56 | name: "good SPIFFE ID", |
| 57 | urls: []*url.URL{ |
| 58 | { |
| 59 | Scheme: "spiffe", |
| 60 | Host: "foo.bar.com", |
| 61 | Path: "workload/wl1", |
| 62 | RawPath: "workload/wl1", |
| 63 | }, |
| 64 | }, |
| 65 | wantID: true, |
| 66 | }, |
| 67 | { |
| 68 | name: "invalid host", |
| 69 | urls: []*url.URL{ |
| 70 | { |
| 71 | Scheme: "spiffe", |
| 72 | Host: "", |
| 73 | Path: "workload/wl1", |
| 74 | RawPath: "workload/wl1", |
| 75 | }, |
| 76 | }, |
| 77 | wantID: false, |
| 78 | }, |
| 79 | { |
| 80 | name: "invalid path", |
| 81 | urls: []*url.URL{ |
| 82 | { |
| 83 | Scheme: "spiffe", |
| 84 | Host: "foo.bar.com", |
| 85 | Path: "", |
| 86 | RawPath: "", |
| 87 | }, |
| 88 | }, |
| 89 | wantID: false, |
| 90 | }, |
| 91 | { |
| 92 | name: "large path", |
| 93 | urls: []*url.URL{ |
| 94 | { |
| 95 | Scheme: "spiffe", |
| 96 | Host: "foo.bar.com", |
| 97 | Path: string(make([]byte, 2050)), |
| 98 | RawPath: string(make([]byte, 2050)), |
| 99 | }, |
| 100 | }, |
nothing calls this directly
no test coverage detected