@@ -13,6 +13,34 @@ mkdir -p gopath/bin
1313export PATH=" $( pwd) /../bin:$GOPATH /bin:$PATH "
1414echo $IPFS_PATH
1515
16+ sort > expected_swarm_addresses << EOF
17+ /ip4/0.0.0.0/tcp/4001
18+ /ip4/0.0.0.0/udp/4001/quic
19+ /ip4/1.2.3.4/udp/4004/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ/p2p-circuit
20+ /ip6/::/tcp/4002
21+ /ip6/::/tcp/4003/ws
22+ /ip6/::/udp/4002/quic
23+ EOF
24+
25+ get_swarm_addresses () {
26+ ipfs config Addresses.Swarm | sed -n -e ' s/^ *"\(.*\)",\?$/\1/p' | sort
27+ }
28+
29+ check_results () {
30+ test_expect_success " get new swarm addresses" '
31+ get_swarm_addresses > actual_swarm_addresses
32+ '
33+
34+
35+ test_expect_success " migration added quic bootstrapper" '
36+ test "$(ipfs config Bootstrap | grep -c "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ")" -eq 1
37+ '
38+
39+ test_expect_success " get new swarm config" '
40+ test_cmp expected_swarm_addresses actual_swarm_addresses
41+ '
42+ }
43+
1644test_install_ipfs_nd " v0.5.1"
1745
1846test_init_ipfs_nd
@@ -28,8 +56,13 @@ test_expect_success "add bootstrap addresses" '
2856]"
2957'
3058
31- test_expect_success " remember old swarm config" '
32- ipfs config Addresses.Swarm | sort > swarm_old
59+ test_expect_success " configure listen addresses" '
60+ test_config_set --json Addresses.Swarm "[
61+ \"/ip4/0.0.0.0/tcp/4001\",
62+ \"/ip6/::/tcp/4002\",
63+ \"/ip6/::/tcp/4003/ws\",
64+ \"/ip4/1.2.3.4/udp/4004/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ/p2p-circuit\"
65+ ]"
3366'
3467
3568# no need to launch daemon as this works offline
@@ -41,22 +74,24 @@ test_expect_success "run migration 9 to 10" '
4174
4275test_install_ipfs_nd " v0.6.0-dev"
4376
44- test_expect_success " migration added quic bootstrapper" '
45- ipfs config Bootstrap | grep "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
46- '
77+ check_results
4778
48- test_expect_success " migration added quic listener" '
49- ipfs config Addresses.Swarm | grep "quic"
79+ test_expect_success " re-run migration 9 to 10" '
80+ echo 9 > "$IPFS_PATH/version" &&
81+ echo $IPFS_PATH &&
82+ ipfs-9-to-10 -verbose -path="$IPFS_PATH"
5083'
5184
85+ # Shouldn't do anything this time, now that we have an address.
86+ check_results
87+
5288test_expect_success " revert migration 10 to 9 succeeds" '
5389 ipfs-9-to-10 -revert -verbose -path="$IPFS_PATH"
5490'
5591
5692test_install_ipfs_nd " v0.5.1"
5793
58- test_expect_success " does not revert bootstrap address" '
59- ipfs config Bootstrap | grep "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
60- '
94+ # Should leave everything alone.
95+ check_results
6196
6297test_done
0 commit comments