@@ -144,38 +144,51 @@ func TestMetadataRetrieval(t *testing.T) {
144144
145145 ipTests := []struct {
146146 name string
147- inputIPs []string
147+ inputIPv4s []string
148+ inputIPv6 string
148149 outputAddresses []v1.NodeAddress
149150 expectedErr error
150151 }{
151- {"no IPs" , nil , nil , instanceNoIPAddressesError {192910 }},
152+ {"no IPs" , nil , "" , nil , instanceNoIPAddressesError {192910 }},
152153 {
153154 "one public, one private" ,
154155 []string {"32.74.121.25" , "192.168.121.42" },
156+ "" ,
155157 []v1.NodeAddress {{Type : v1 .NodeExternalIP , Address : "32.74.121.25" }, {Type : v1 .NodeInternalIP , Address : "192.168.121.42" }},
156158 nil ,
157159 },
160+ {
161+ "one public ipv4, one public ipv6" ,
162+ []string {"32.74.121.25" },
163+ "2600:3c06::f03c:94ff:fe1e:e072" ,
164+ []v1.NodeAddress {{Type : v1 .NodeExternalIP , Address : "32.74.121.25" }, {Type : v1 .NodeExternalIP , Address : "2600:3c06::f03c:94ff:fe1e:e072" }},
165+ nil ,
166+ },
158167 {
159168 "one public, no private" ,
160169 []string {"32.74.121.25" },
170+ "" ,
161171 []v1.NodeAddress {{Type : v1 .NodeExternalIP , Address : "32.74.121.25" }},
162172 nil ,
163173 },
164174 {
165175 "one private, no public" ,
166176 []string {"192.168.121.42" },
177+ "" ,
167178 []v1.NodeAddress {{Type : v1 .NodeInternalIP , Address : "192.168.121.42" }},
168179 nil ,
169180 },
170181 {
171182 "two public addresses" ,
172183 []string {"32.74.121.25" , "32.74.121.22" },
184+ "" ,
173185 []v1.NodeAddress {{Type : v1 .NodeExternalIP , Address : "32.74.121.25" }, {Type : v1 .NodeExternalIP , Address : "32.74.121.22" }},
174186 nil ,
175187 },
176188 {
177189 "two private addresses" ,
178190 []string {"192.168.121.42" , "10.0.2.15" },
191+ "" ,
179192 []v1.NodeAddress {{Type : v1 .NodeInternalIP , Address : "192.168.121.42" }, {Type : v1 .NodeInternalIP , Address : "10.0.2.15" }},
180193 nil ,
181194 },
@@ -189,8 +202,8 @@ func TestMetadataRetrieval(t *testing.T) {
189202 providerID := providerIDPrefix + strconv .Itoa (id )
190203 node := nodeWithProviderID (providerID )
191204
192- ips := make ([]* net.IP , 0 , len (test .inputIPs ))
193- for _ , ip := range test .inputIPs {
205+ ips := make ([]* net.IP , 0 , len (test .inputIPv4s ))
206+ for _ , ip := range test .inputIPv4s {
194207 parsed := net .ParseIP (ip )
195208 if parsed == nil {
196209 t .Fatalf ("cannot parse %v as an ipv4" , ip )
@@ -201,7 +214,7 @@ func TestMetadataRetrieval(t *testing.T) {
201214 linodeType := "g6-standard-1"
202215 region := "us-east"
203216 client .EXPECT ().ListInstances (gomock .Any (), nil ).Times (1 ).Return ([]linodego.Instance {
204- {ID : id , Label : name , Type : linodeType , Region : region , IPv4 : ips },
217+ {ID : id , Label : name , Type : linodeType , Region : region , IPv4 : ips , IPv6 : test . inputIPv6 },
205218 }, nil )
206219
207220 meta , err := instances .InstanceMetadata (ctx , node )
0 commit comments