From 9c127165076844a846797b360d7758e274046ac5 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Thu, 16 Feb 2023 12:20:36 +0100 Subject: [PATCH 1/4] test: fix the grep in t0046 --- test/sharness/t0046-id-hash.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/sharness/t0046-id-hash.sh b/test/sharness/t0046-id-hash.sh index d4c28f21507..89518274642 100755 --- a/test/sharness/t0046-id-hash.sh +++ b/test/sharness/t0046-id-hash.sh @@ -25,7 +25,8 @@ test_expect_success "ipfs add succeeds with identity hash" ' ' test_expect_success "content not actually added" ' - ipfs refs local | fgrep -q -v $HASH + ipfs refs local > locals && + test_should_not_contain $HASH locals ' test_expect_success "but can fetch it anyway" ' @@ -98,7 +99,8 @@ test_expect_success "ipfs add succeeds with identity hash and --nocopy" ' ' test_expect_success "content not actually added (filestore enabled)" ' - ipfs refs local | fgrep -q -v $HASH + ipfs refs local > locals && + test_should_not_contain $HASH locals ' test_expect_success "but can fetch it anyway (filestore enabled)" ' From c35b03132970d7d98632979457c40371ec5698fc Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Wed, 16 Aug 2023 15:43:18 +0200 Subject: [PATCH 2/4] test: fix grep -v in t0140 --- test/sharness/t0140-swarm.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/sharness/t0140-swarm.sh b/test/sharness/t0140-swarm.sh index d65831d3e22..3330e44ecf8 100755 --- a/test/sharness/t0140-swarm.sh +++ b/test/sharness/t0140-swarm.sh @@ -101,11 +101,11 @@ test_launch_ipfs_daemon test_expect_success "Addresses.NoAnnounce affects addresses from Announce and AppendAnnounce" ' ipfs swarm addrs local >actual && - grep -v "/ip4/1.2.3.4/tcp/1234" actual && - grep -v "/ip4/10.20.30.40/tcp/4321" 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 && ipfs id -f"" | xargs -n1 echo >actual && - grep -v "/ip4/1.2.3.4/tcp/1234" actual && - grep -v "//ip4/10.20.30.40/tcp/4321" 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_kill_ipfs_daemon @@ -119,9 +119,9 @@ test_launch_ipfs_daemon test_expect_success "Addresses.NoAnnounce with /ipcidr affects addresses" ' ipfs swarm addrs local >actual && - grep -v "/ip4/1.2.3.4/tcp/1234" actual && + test_should_not_contain "/ip4/1.2.3.4/tcp/1234" actual && ipfs id -f"" | xargs -n1 echo >actual && - grep -v "/ip4/1.2.3.4/tcp/1234" actual + test_should_not_contain "/ip4/1.2.3.4/tcp/1234" actual ' test_kill_ipfs_daemon From f22738e1a2e0838edf023b4d13c140cec7012cfa Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Wed, 16 Aug 2023 16:03:42 +0200 Subject: [PATCH 3/4] wip: confirm the bug --- test/sharness/t0140-swarm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/sharness/t0140-swarm.sh b/test/sharness/t0140-swarm.sh index 3330e44ecf8..90bb65fbadd 100755 --- a/test/sharness/t0140-swarm.sh +++ b/test/sharness/t0140-swarm.sh @@ -101,6 +101,7 @@ 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"" | xargs -n1 echo >actual && From 038e56d4130d85ef1423df1db26f8b6f96e891f2 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 17 Aug 2023 22:53:35 +0200 Subject: [PATCH 4/4] test: Addresses.NoAnnounce overides AppendAnnounce --- test/sharness/t0140-swarm.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/test/sharness/t0140-swarm.sh b/test/sharness/t0140-swarm.sh index 90bb65fbadd..37bb44b6440 100755 --- a/test/sharness/t0140-swarm.sh +++ b/test/sharness/t0140-swarm.sh @@ -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"" | 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 @@ -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"" | 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' " @@ -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"" | 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