Skip to content

Commit

Permalink
test: Addresses.NoAnnounce overides AppendAnnounce
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Aug 17, 2023
1 parent f22738e commit 038e56d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/sharness/t0140-swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ test_launch_ipfs_daemon

test_expect_success 'Addresses.Announce affects addresses' '
ipfs swarm addrs local >actual &&
grep "/ip4/1.2.3.4/tcp/1234" actual &&
test_should_contain "/ip4/1.2.3.4/tcp/1234" actual &&
ipfs id -f"<addrs>" | xargs -n1 echo >actual &&
grep "/ip4/1.2.3.4/tcp/1234" actual
test_should_contain "/ip4/1.2.3.4/tcp/1234" actual
'

test_kill_ipfs_daemon
Expand All @@ -81,18 +81,18 @@ test_launch_ipfs_daemon

test_expect_success 'Addresses.AppendAnnounce is applied on top of Announce' '
ipfs swarm addrs local >actual &&
grep "/ip4/1.2.3.4/tcp/1234" actual &&
grep "/dnsaddr/dynamic.example.com" actual &&
grep "/ip4/10.20.30.40/tcp/4321" actual &&
test_should_contain "/ip4/1.2.3.4/tcp/1234" actual &&
test_should_contain "/dnsaddr/dynamic.example.com" actual &&
test_should_contain "/ip4/10.20.30.40/tcp/4321" actual &&
ipfs id -f"<addrs>" | xargs -n1 echo | tee actual &&
grep "/ip4/1.2.3.4/tcp/1234/p2p" actual &&
grep "/dnsaddr/dynamic.example.com/p2p/" actual &&
grep "/ip4/10.20.30.40/tcp/4321/p2p/" actual
test_should_contain "/ip4/1.2.3.4/tcp/1234/p2p" actual &&
test_should_contain "/dnsaddr/dynamic.example.com/p2p/" actual &&
test_should_contain "/ip4/10.20.30.40/tcp/4321/p2p/" actual
'

test_kill_ipfs_daemon

noAnnounceCfg='["/ip4/1.2.3.4/tcp/1234"]'
noAnnounceCfg='["/ip4/1.2.3.4/tcp/1234", "/ip4/10.20.30.40/tcp/4321"]'
test_expect_success "test_config_set succeeds" "
ipfs config --json Addresses.NoAnnounce '$noAnnounceCfg'
"
Expand All @@ -101,12 +101,11 @@ test_launch_ipfs_daemon

test_expect_success "Addresses.NoAnnounce affects addresses from Announce and AppendAnnounce" '
ipfs swarm addrs local >actual &&
cat actual && # confirm the bug
test_should_not_contain "/ip4/1.2.3.4/tcp/1234" actual &&
test_should_not_contain "/ip4/10.20.30.40/tcp/4321" actual &&
ipfs id -f"<addrs>" | xargs -n1 echo >actual &&
test_should_not_contain "/ip4/1.2.3.4/tcp/1234" actual &&
test_should_not_contain "//ip4/10.20.30.40/tcp/4321" actual
test_should_not_contain "/ip4/10.20.30.40/tcp/4321" actual
'

test_kill_ipfs_daemon
Expand Down

0 comments on commit 038e56d

Please sign in to comment.