Fixes #13878.
Signed-off-by: Eric-Olivier Lamey <eo@lamey.me>
| ... | ... |
@@ -2,6 +2,7 @@ package opts |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 |
+ "net" |
|
| 5 | 6 |
"strings" |
| 6 | 7 |
"testing" |
| 7 | 8 |
) |
| ... | ... |
@@ -179,6 +180,18 @@ func TestValidateExtraHosts(t *testing.T) {
|
| 179 | 179 |
} |
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 |
+func TestIpOptString(t *testing.T) {
|
|
| 183 |
+ addresses := []string{"", "0.0.0.0"}
|
|
| 184 |
+ var ip net.IP |
|
| 185 |
+ |
|
| 186 |
+ for _, address := range addresses {
|
|
| 187 |
+ stringAddress := NewIpOpt(&ip, address).String() |
|
| 188 |
+ if stringAddress != address {
|
|
| 189 |
+ t.Fatalf("IpOpt string should be `%s`, not `%s`", address, stringAddress)
|
|
| 190 |
+ } |
|
| 191 |
+ } |
|
| 192 |
+} |
|
| 193 |
+ |
|
| 182 | 194 |
func logOptsValidator(val string) (string, error) {
|
| 183 | 195 |
allowedKeys := map[string]string{"max-size": "1", "max-file": "2"}
|
| 184 | 196 |
vals := strings.Split(val, "=") |