(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestCreateBindStr(t *testing.T) { |
| 11 | // Test all combinations of CLI arg address, CLI arg port, and env var string |
| 12 | // as inputs to create netcheck bind string. |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | cliAddress string |
| 16 | cliAddressIsSet bool |
| 17 | cliPort int |
| 18 | cliPortIsSet bool |
| 19 | envBind string |
| 20 | want string |
| 21 | wantError string |
| 22 | }{ |
| 23 | { |
| 24 | name: "noAddr-noPort-noEnv", |
| 25 | want: ":0", |
| 26 | }, |
| 27 | { |
| 28 | name: "yesAddrv4-noPort-noEnv", |
| 29 | cliAddress: "100.123.123.123", |
| 30 | cliAddressIsSet: true, |
| 31 | want: "100.123.123.123:0", |
| 32 | }, |
| 33 | { |
| 34 | name: "yesAddrv6-noPort-noEnv", |
| 35 | cliAddress: "dead::beef", |
| 36 | cliAddressIsSet: true, |
| 37 | want: "[dead::beef]:0", |
| 38 | }, |
| 39 | { |
| 40 | name: "yesAddr-yesPort-noEnv", |
| 41 | cliAddress: "100.123.123.123", |
| 42 | cliAddressIsSet: true, |
| 43 | cliPort: 456, |
| 44 | cliPortIsSet: true, |
| 45 | want: "100.123.123.123:456", |
| 46 | }, |
| 47 | { |
| 48 | name: "yesAddr-yesPort-yesEnv", |
| 49 | cliAddress: "100.123.123.123", |
| 50 | cliAddressIsSet: true, |
| 51 | cliPort: 456, |
| 52 | cliPortIsSet: true, |
| 53 | envBind: "55.55.55.55:789", |
| 54 | want: "100.123.123.123:456", |
| 55 | }, |
| 56 | { |
| 57 | name: "noAddr-yesPort-noEnv", |
| 58 | cliPort: 456, |
| 59 | cliPortIsSet: true, |
| 60 | want: ":456", |
| 61 | }, |
| 62 | { |
| 63 | name: "noAddr-yesPort-yesEnv", |
| 64 | cliPort: 456, |
| 65 | cliPortIsSet: true, |
| 66 | envBind: "55.55.55.55:789", |
| 67 | want: ":456", |
nothing calls this directly
no test coverage detected
searching dependent graphs…