Skip to content

Commit 97f7d8f

Browse files
committed
Try make IPv6 work on travis
1 parent 04e4646 commit 97f7d8f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ branches:
44
only:
55
- master
66

7+
before_install:
8+
# Add an IPv6 config - see the corresponding Travis issue
9+
# https://github.com/travis-ci/travis-ci/issues/8361
10+
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
11+
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
12+
fi
13+
714
cache: cargo
815

916
matrix:

libp2p-tcp-transport/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ mod tests {
258258
}
259259

260260
#[test]
261-
fn replace_port_0_in_returned_multiaddr() {
261+
fn replace_port_0_in_returned_multiaddr_ipv4() {
262262
let core = Core::new().unwrap();
263263
let tcp = TcpConfig::new(core.handle());
264264

@@ -269,6 +269,18 @@ mod tests {
269269
assert!(!new_addr.to_string().contains("tcp/0"));
270270
}
271271

272+
#[test]
273+
fn replace_port_0_in_returned_multiaddr_ipv6() {
274+
let core = Core::new().unwrap();
275+
let tcp = TcpConfig::new(core.handle());
276+
277+
let addr = Multiaddr::new("/ip6/::1/tcp/0").unwrap();
278+
assert!(addr.to_string().contains("tcp/0"));
279+
280+
let (_, new_addr) = tcp.listen_on(addr).unwrap();
281+
assert!(!new_addr.to_string().contains("tcp/0"));
282+
}
283+
272284
#[test]
273285
fn larger_addr_denied() {
274286
let core = Core::new().unwrap();

0 commit comments

Comments
 (0)