|
|
|
@ -216,7 +216,7 @@ TEST_F(AddressSortingTest, TestDepriotizesUnreachableAddresses) { |
|
|
|
|
{"1.2.3.4:443", AF_INET}, |
|
|
|
|
{"5.6.7.8:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"1.2.3.4:443", |
|
|
|
|
"5.6.7.8:443", |
|
|
|
@ -235,7 +235,7 @@ TEST_F(AddressSortingTest, TestDepriotizesUnsupportedDomainIpv6) { |
|
|
|
|
{"[2607:f8b0:400a:801::1002]:443", AF_INET6}, |
|
|
|
|
{"1.2.3.4:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"1.2.3.4:443", |
|
|
|
|
"[2607:f8b0:400a:801::1002]:443", |
|
|
|
@ -255,7 +255,7 @@ TEST_F(AddressSortingTest, TestDepriotizesUnsupportedDomainIpv4) { |
|
|
|
|
{"[2607:f8b0:400a:801::1002]:443", AF_INET6}, |
|
|
|
|
{"1.2.3.4:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[2607:f8b0:400a:801::1002]:443", |
|
|
|
|
"1.2.3.4:443", |
|
|
|
@ -279,7 +279,7 @@ TEST_F(AddressSortingTest, TestDepriotizesNonMatchingScope) { |
|
|
|
|
{"[2000:f8b0:400a:801::1002]:443", AF_INET6}, |
|
|
|
|
{"[fec0::5000]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[fec0::5000]:443", |
|
|
|
|
"[2000:f8b0:400a:801::1002]:443", |
|
|
|
@ -302,7 +302,7 @@ TEST_F(AddressSortingTest, TestUsesLabelFromDefaultTable) { |
|
|
|
|
{"[2002::5001]:443", AF_INET6}, |
|
|
|
|
{"[2001::5001]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[2001::5001]:443", |
|
|
|
|
"[2002::5001]:443", |
|
|
|
@ -325,7 +325,7 @@ TEST_F(AddressSortingTest, TestUsesLabelFromDefaultTableInputFlipped) { |
|
|
|
|
{"[2001::5001]:443", AF_INET6}, |
|
|
|
|
{"[2002::5001]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[2001::5001]:443", |
|
|
|
|
"[2002::5001]:443", |
|
|
|
@ -348,7 +348,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{"[3ffe::5001]:443", AF_INET6}, |
|
|
|
|
{"1.2.3.4:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs( |
|
|
|
|
lb_addrs, { |
|
|
|
|
// The AF_INET address should be IPv4-mapped by the sort,
|
|
|
|
@ -381,7 +381,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{v4_compat_dest, AF_INET6}, |
|
|
|
|
{"[::1]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[::1]:443", |
|
|
|
|
v4_compat_dest, |
|
|
|
@ -404,7 +404,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{"[1234::2]:443", AF_INET6}, |
|
|
|
|
{"[::1]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs( |
|
|
|
|
lb_addrs, |
|
|
|
|
{ |
|
|
|
@ -428,7 +428,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{"[2001::1234]:443", AF_INET6}, |
|
|
|
|
{"[2000::5001]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs( |
|
|
|
|
lb_addrs, { |
|
|
|
|
// The 2000::/16 address should match the ::/0 prefix rule
|
|
|
|
@ -452,7 +452,7 @@ TEST_F( |
|
|
|
|
{"[2001::1231]:443", AF_INET6}, |
|
|
|
|
{"[2000::5001]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[2000::5001]:443", |
|
|
|
|
"[2001::1231]:443", |
|
|
|
@ -473,7 +473,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{"[fec0::1234]:443", AF_INET6}, |
|
|
|
|
{"[fc00::5001]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[fc00::5001]:443", |
|
|
|
|
"[fec0::1234]:443", |
|
|
|
@ -498,7 +498,7 @@ TEST_F( |
|
|
|
|
{"[::ffff:1.1.1.2]:443", AF_INET6}, |
|
|
|
|
{"[1234::2]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
// ::ffff:0:2 should match the v4-mapped
|
|
|
|
|
// precedence entry and be deprioritized.
|
|
|
|
@ -525,7 +525,7 @@ TEST_F(AddressSortingTest, TestPrefersSmallerScope) { |
|
|
|
|
{"[3ffe::5001]:443", AF_INET6}, |
|
|
|
|
{"[fec0::1234]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[fec0::1234]:443", |
|
|
|
|
"[3ffe::5001]:443", |
|
|
|
@ -550,7 +550,7 @@ TEST_F(AddressSortingTest, TestPrefersLongestMatchingSrcDstPrefix) { |
|
|
|
|
{"[3ffe:5001::]:443", AF_INET6}, |
|
|
|
|
{"[3ffe:1234::]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe:1234::]:443", |
|
|
|
|
"[3ffe:5001::]:443", |
|
|
|
@ -571,7 +571,7 @@ TEST_F(AddressSortingTest, |
|
|
|
|
{"[3ffe::5001]:443", AF_INET6}, |
|
|
|
|
{"[3ffe::1234]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe::1234]:443", |
|
|
|
|
"[3ffe::5001]:443", |
|
|
|
@ -591,7 +591,7 @@ TEST_F(AddressSortingTest, TestPrefersLongestPrefixStressInnerBytePrefix) { |
|
|
|
|
{"[3ffe:8000::]:443", AF_INET6}, |
|
|
|
|
{"[3ffe:2000::]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe:2000::]:443", |
|
|
|
|
"[3ffe:8000::]:443", |
|
|
|
@ -611,7 +611,7 @@ TEST_F(AddressSortingTest, TestPrefersLongestPrefixDiffersOnHighestBitOfByte) { |
|
|
|
|
{"[3ffe:6::]:443", AF_INET6}, |
|
|
|
|
{"[3ffe:c::]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe:c::]:443", |
|
|
|
|
"[3ffe:6::]:443", |
|
|
|
@ -633,7 +633,7 @@ TEST_F(AddressSortingTest, TestPrefersLongestPrefixDiffersByLastBit) { |
|
|
|
|
{"[3ffe:1111:1111:1110::]:443", AF_INET6}, |
|
|
|
|
{"[3ffe:1111:1111:1111::]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe:1111:1111:1111::]:443", |
|
|
|
|
"[3ffe:1111:1111:1110::]:443", |
|
|
|
@ -655,7 +655,7 @@ TEST_F(AddressSortingTest, TestStableSort) { |
|
|
|
|
{"[3ffe::1234]:443", AF_INET6}, |
|
|
|
|
{"[3ffe::1235]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe::1234]:443", |
|
|
|
|
"[3ffe::1235]:443", |
|
|
|
@ -681,7 +681,7 @@ TEST_F(AddressSortingTest, TestStableSortFiveElements) { |
|
|
|
|
{"[3ffe::1234]:443", AF_INET6}, |
|
|
|
|
{"[3ffe::1235]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe::1231]:443", |
|
|
|
|
"[3ffe::1232]:443", |
|
|
|
@ -702,7 +702,7 @@ TEST_F(AddressSortingTest, TestStableSortNoSrcAddrsExist) { |
|
|
|
|
{"[3ffe::1234]:443", AF_INET6}, |
|
|
|
|
{"[3ffe::1235]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[3ffe::1231]:443", |
|
|
|
|
"[3ffe::1232]:443", |
|
|
|
@ -720,7 +720,7 @@ TEST_F(AddressSortingTest, TestStableSortNoSrcAddrsExistWithIpv4) { |
|
|
|
|
{"[::ffff:5.6.7.8]:443", AF_INET6}, |
|
|
|
|
{"1.2.3.4:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[::ffff:5.6.7.8]:443", |
|
|
|
|
"1.2.3.4:443", |
|
|
|
@ -748,7 +748,7 @@ TEST_F(AddressSortingTest, TestStableSortV4CompatAndSiteLocalAddresses) { |
|
|
|
|
{"[fec0::2000]:443", AF_INET6}, |
|
|
|
|
{v4_compat_dest, AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, |
|
|
|
|
{ |
|
|
|
|
// The sort should be stable since
|
|
|
|
@ -769,7 +769,7 @@ TEST_F(AddressSortingTest, TestPrefersIpv6Loopback) { |
|
|
|
|
{"[::1]:443", AF_INET6}, |
|
|
|
|
{"127.0.0.1:443", AF_INET}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[::1]:443", |
|
|
|
|
"127.0.0.1:443", |
|
|
|
@ -783,7 +783,7 @@ TEST_F(AddressSortingTest, TestPrefersIpv6LoopbackInputsFlipped) { |
|
|
|
|
{"127.0.0.1:443", AF_INET}, |
|
|
|
|
{"[::1]:443", AF_INET6}, |
|
|
|
|
}); |
|
|
|
|
grpc_cares_wrapper_test_only_address_sorting_sort(lb_addrs); |
|
|
|
|
grpc_cares_wrapper_address_sorting_sort(lb_addrs); |
|
|
|
|
VerifyLbAddrOutputs(lb_addrs, { |
|
|
|
|
"[::1]:443", |
|
|
|
|
"127.0.0.1:443", |
|
|
|
|