@@ -35,6 +35,7 @@ func TestInitCurlCmd(t *testing.T) {
3535 "insecure" : {[]string {"--insecure" }, func () (interface {}, interface {}) { return curlInsecure , true }},
3636 "http2" : {[]string {"--http2" }, func () (interface {}, interface {}) { return curlHTTP2 , true }},
3737 "limit" : {[]string {"--limit" , "23" }, func () (interface {}, interface {}) { return curlLimit , 23 }},
38+ "ipv6" : {[]string {"--ipv6" }, func () (interface {}, interface {}) { return curlIpv6 , true }},
3839 }
3940 parent := & cobra.Command {}
4041 for name , tc := range testCases {
@@ -63,15 +64,17 @@ func TestRunCurlResolve(t *testing.T) {
6364 head bool
6465 insecure bool
6566 http2 bool
67+ ipv6 bool
6668 from string
6769 nodeIDs []int
6870 exp string
6971 }{
70- "Head" : {false , false , false , "From here" , []int {}, `{"target":"example.com","head":false,"location":"From here","limit":12}` },
71- "Insecure" : {true , true , false , "From here" , []int {}, `{"target":"example.com","head":true,"insecure":true,"location":"From here","limit":12}` },
72- "HTTP2" : {true , false , true , "From here" , []int {}, `{"target":"example.com","head":true,"http2":true,"location":"From here","limit":12}` },
73- "Location" : {true , false , false , "From here" , []int {}, `{"target":"example.com","head":true,"location":"From here","limit":12}` },
74- "NodeID" : {true , false , false , "" , []int {123 }, `{"target":"example.com","head":true,"nodes":"123","limit":12}` },
72+ "Head" : {false , false , false , false , "From here" , []int {}, `{"target":"example.com","head":false,"location":"From here","limit":12,"ipversion":4}` },
73+ "Insecure" : {true , true , false , false , "From here" , []int {}, `{"target":"example.com","head":true,"insecure":true,"location":"From here","limit":12,"ipversion":4}` },
74+ "HTTP2" : {true , false , true , false , "From here" , []int {}, `{"target":"example.com","head":true,"http2":true,"location":"From here","limit":12,"ipversion":4}` },
75+ "Location" : {true , false , false , false , "From here" , []int {}, `{"target":"example.com","head":true,"location":"From here","limit":12,"ipversion":4}` },
76+ "NodeID" : {true , false , false , false , "" , []int {123 }, `{"target":"example.com","head":true,"nodes":"123","limit":12,"ipversion":4}` },
77+ "IPv6" : {false , false , false , true , "" , []int {}, `{"target":"example.com","head":false,"limit":12,"ipversion":6}` },
7578 }
7679 // We're only interested in the first HTTP call, e.g., the one to get the test ID
7780 // to validate our parameters got passed properly.
@@ -82,7 +85,7 @@ func TestRunCurlResolve(t *testing.T) {
8285 }
8386 for name , tc := range testCases {
8487 t .Run (name , func (t * testing.T ) {
85- runCurl (c , "example.com" , tc .head , tc .insecure , tc .http2 , tc .from , tc .nodeIDs , 12 , "file.txt" )
88+ runCurl (c , "example.com" , tc .head , tc .insecure , tc .http2 , tc .from , tc .nodeIDs , 12 , "file.txt" , tc . ipv6 )
8689 if got , exp := tr .req .URL .Path , "/run/curl" ; got != exp {
8790 t .Fatalf ("expected %v; got %v" , exp , got )
8891 }
0 commit comments