Skip to content

Instantly share code, notes, and snippets.

@whyrusleeping
Created November 22, 2017 05:37
Show Gist options
  • Save whyrusleeping/9f4bef1726577e14a67568b9cd997f5a to your computer and use it in GitHub Desktop.
Save whyrusleeping/9f4bef1726577e14a67568b9cd997f5a to your computer and use it in GitHub Desktop.
*** test/sharness/t0240-republisher.sh ***
# TEST_VERBOSE=1
# TEST_NO_FUSE=1
# TEST_NO_PLUGIN=
# TEST_EXPENSIVE=1
# TEST_OS=LINUX
expecting success:
iptb init -n $num_nodes --bootstrap none --port 0
ok 1 - iptb init
expecting success:
ipfsi "$i" config Ipns.RepublishPeriod 20s &&
ipfsi "$i" config --json Ipns.ResolveCacheSize 0
ok 2 - set configs up for node 0
expecting success:
ipfsi "$i" config Ipns.RepublishPeriod 20s &&
ipfsi "$i" config --json Ipns.ResolveCacheSize 0
ok 3 - set configs up for node 1
expecting success:
ipfsi "$i" config Ipns.RepublishPeriod 20s &&
ipfsi "$i" config --json Ipns.ResolveCacheSize 0
ok 4 - set configs up for node 2
expecting success:
ipfsi "$i" config Ipns.RepublishPeriod 20s &&
ipfsi "$i" config --json Ipns.ResolveCacheSize 0
ok 5 - set configs up for node 3
expecting success:
iptb start
Started daemon /go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0240-republisher.sh/.iptb/0, pid = 17843
Started daemon /go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0240-republisher.sh/.iptb/1, pid = 17860
Started daemon /go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0240-republisher.sh/.iptb/2, pid = 17874
Started daemon /go/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0240-republisher.sh/.iptb/3, pid = 17887
ok 6 - start up nodes
expecting success:
iptb connect [1-$bound] 0
connecting QmUVNakNFowDfPSWCnpnLvVfczeb8FLCkkBTMAvhA4rGyP -> QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
Addresses: [/ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa /ip4/172.17.0.4/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa]
trying ipfs swarm connect /ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
connection success!
connecting QmShyuQxE4st9ckuEx6rxmkxaVZRdpRgEYpqfvctP94QrW -> QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
Addresses: [/ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa /ip4/172.17.0.4/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa]
trying ipfs swarm connect /ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
connection success!
connecting QmfKnmPZePwwhehTEUxtqCz4ZhzKVuxJp2aZQxzQZDSq4t -> QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
Addresses: [/ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa /ip4/172.17.0.4/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa]
trying ipfs swarm connect /ip4/127.0.0.1/tcp/45419/ipfs/QmedVTySDtuRpxzy5sVRSDFv2GdhFEkhJRdRtzyqb3DJpa
connection success!
ok 7 - connect nodes to eachother
expecting success:
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
ok 8 - node 0 is connected
expecting success:
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
ok 9 - node 1 is connected
expecting success:
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
ok 10 - node 2 is connected
expecting success:
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
ok 11 - node 3 is connected
expecting success:
HASH=$(echo "foobar" | ipfsi 1 add -q) &&
ipfsi 1 name publish -t 5s $HASH
Published to QmUVNakNFowDfPSWCnpnLvVfczeb8FLCkkBTMAvhA4rGyP: /ipfs/QmRgutAxd8t7oGkSm4wmeuByG6M51wcTso6cubDdQtuEfL
ok 12 - publish succeeds
expecting success:
id=$(ipfsi 1 id -f "<id>")
ok 13 - get id succeeds
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 14 - just after publishing: node 0 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 15 - just after publishing: output for node 0 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 16 - just after publishing: node 1 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 17 - just after publishing: output for node 1 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 18 - just after publishing: node 2 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 19 - just after publishing: output for node 2 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 20 - just after publishing: node 3 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 21 - just after publishing: output for node 3 looks right
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
Error: Could not resolve name.
ok 22 - after five seconds, records are invalid: resolution fails on node 0
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
Error: Could not resolve name.
ok 23 - after five seconds, records are invalid: resolution fails on node 1
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
Error: Could not resolve name.
ok 24 - after five seconds, records are invalid: resolution fails on node 2
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
Error: Could not resolve name.
ok 25 - after five seconds, records are invalid: resolution fails on node 3
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 26 - republisher fires after twenty seconds: node 0 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 27 - republisher fires after twenty seconds: output for node 0 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 28 - republisher fires after twenty seconds: node 1 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 29 - republisher fires after twenty seconds: output for node 1 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 30 - republisher fires after twenty seconds: node 2 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 31 - republisher fires after twenty seconds: output for node 2 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 32 - republisher fires after twenty seconds: node 3 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 33 - republisher fires after twenty seconds: output for node 3 looks right
expecting success:
KEY2=`ipfsi 1 key gen beepboop --type ed25519`
ok 34 - generate new key
expecting success:
HASH=$(echo "barfoo" | ipfsi 1 add -q) &&
ipfsi 1 name publish -t 5s -k "$KEY2" $HASH
Published to QmfABPKBof9xtnCZuJRNJAdfZupLwgtryB7TuVHBdWh6K2: /ipfs/QmPJ4A6Su27ABvvduX78x2qdWMzkdAYxqeH5TVrHeo3xyy
ok 35 - publish with new key succeeds
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 36 - new key just after publishing: node 0 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 37 - new key just after publishing: output for node 0 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 38 - new key just after publishing: node 1 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 39 - new key just after publishing: output for node 1 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 40 - new key just after publishing: node 2 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 41 - new key just after publishing: output for node 2 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 42 - new key just after publishing: node 3 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 43 - new key just after publishing: output for node 3 looks right
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
/ipfs/QmPJ4A6Su27ABvvduX78x2qdWMzkdAYxqeH5TVrHeo3xyy
test_expect_code: command exited with 0, we wanted 1 ipfsi 0 name resolve --timeout=300ms QmfABPKBof9xtnCZuJRNJAdfZupLwgtryB7TuVHBdWh6K2
not ok 44 - new key cannot resolve after 5 seconds: resolution fails on node 0
#
# # TODO: this should work without the timeout option
# # but it currently hangs for some reason every so often
# test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
#
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
/ipfs/QmPJ4A6Su27ABvvduX78x2qdWMzkdAYxqeH5TVrHeo3xyy
test_expect_code: command exited with 0, we wanted 1 ipfsi 1 name resolve --timeout=300ms QmfABPKBof9xtnCZuJRNJAdfZupLwgtryB7TuVHBdWh6K2
not ok 45 - new key cannot resolve after 5 seconds: resolution fails on node 1
#
# # TODO: this should work without the timeout option
# # but it currently hangs for some reason every so often
# test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
#
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
/ipfs/QmPJ4A6Su27ABvvduX78x2qdWMzkdAYxqeH5TVrHeo3xyy
test_expect_code: command exited with 0, we wanted 1 ipfsi 2 name resolve --timeout=300ms QmfABPKBof9xtnCZuJRNJAdfZupLwgtryB7TuVHBdWh6K2
not ok 46 - new key cannot resolve after 5 seconds: resolution fails on node 2
#
# # TODO: this should work without the timeout option
# # but it currently hangs for some reason every so often
# test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
#
expecting success:
# TODO: this should work without the timeout option
# but it currently hangs for some reason every so often
test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
/ipfs/QmPJ4A6Su27ABvvduX78x2qdWMzkdAYxqeH5TVrHeo3xyy
test_expect_code: command exited with 0, we wanted 1 ipfsi 3 name resolve --timeout=300ms QmfABPKBof9xtnCZuJRNJAdfZupLwgtryB7TuVHBdWh6K2
not ok 47 - new key cannot resolve after 5 seconds: resolution fails on node 3
#
# # TODO: this should work without the timeout option
# # but it currently hangs for some reason every so often
# test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
#
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 48 - new key can resolve again after republish: node 0 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 49 - new key can resolve again after republish: output for node 0 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 50 - new key can resolve again after republish: node 1 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 51 - new key can resolve again after republish: output for node 1 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 52 - new key can resolve again after republish: node 2 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 53 - new key can resolve again after republish: output for node 2 looks right
expecting success:
ipfsi "$node" name resolve "$name" > resolve
ok 54 - new key can resolve again after republish: node 3 can resolve entry
expecting success:
printf "/ipfs/$expected\n" > expected &&
test_cmp expected resolve
ok 55 - new key can resolve again after republish: output for node 3 looks right
expecting success:
iptb kill
ok 56 - shut down nodes
# failed 4 among 56 test(s)
1..56
test/sharness/Rules.mk:31: recipe for target 'test/sharness/t0240-republisher.sh' failed
make: *** [test/sharness/t0240-republisher.sh] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment