(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func Test_processDNSValue(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | name string |
| 13 | dnsValue string |
| 14 | want []string |
| 15 | wantErr bool |
| 16 | }{ |
| 17 | |
| 18 | { |
| 19 | name: "fail/empty", |
| 20 | dnsValue: "", |
| 21 | want: nil, |
| 22 | wantErr: true, |
| 23 | }, |
| 24 | { |
| 25 | name: "fail/empty-multiple", |
| 26 | dnsValue: ",,", |
| 27 | want: nil, |
| 28 | wantErr: true, |
| 29 | }, |
| 30 | { |
| 31 | name: "fail/dns", |
| 32 | dnsValue: "ca.smallstep.com:8443", |
| 33 | want: nil, |
| 34 | wantErr: true, |
| 35 | }, |
| 36 | { |
| 37 | name: "fail/ipv4", |
| 38 | dnsValue: "127.0.0.1:8080", |
| 39 | want: nil, |
| 40 | wantErr: true, |
| 41 | }, |
| 42 | { |
| 43 | name: "fail/ipv6", |
| 44 | dnsValue: ":::1", |
| 45 | want: nil, |
| 46 | wantErr: true, |
| 47 | }, |
| 48 | { |
| 49 | name: "ok/dns", |
| 50 | dnsValue: "ca.smallstep.com", |
| 51 | want: []string{"ca.smallstep.com"}, |
| 52 | wantErr: false, |
| 53 | }, |
| 54 | { |
| 55 | name: "ok/multi-dns", |
| 56 | dnsValue: "ca.smallstep.com,ca.localhost", |
| 57 | want: []string{"ca.smallstep.com", "ca.localhost"}, |
| 58 | wantErr: false, |
| 59 | }, |
| 60 | { |
| 61 | name: "ok/multi-dns-with-skip", |
| 62 | dnsValue: "ca.smallstep.com,ca.localhost,,test.localhost", |
| 63 | want: []string{"ca.smallstep.com", "ca.localhost", "test.localhost"}, |
| 64 | wantErr: false, |
| 65 | }, |
| 66 | { |
| 67 | name: "ok/multi-space-dns", |
nothing calls this directly
no test coverage detected
searching dependent graphs…