@cryptotaxi247 / kubo / commits / dc68ae76e

t0020: simplify peerid check

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Aug 30, 2015 at 18:23 UTC dc68ae76e38e2c23bb543ebce89cb425d566d225
1 file changed +6 -6
test/sharness/t0020-init.sh
+6 -6
@@ -58,11 +58,13 @@ test_expect_success "ipfs config succeeds" '
58 test_cmp expected_config actual_config
59 '
60
61 +test_check_peerid() {
62 + test $(echo "$1" | tr -dC "[:alnum:]" | wc -c | tr -d " ") = "46"
63 +}
64 +
65 test_expect_success "ipfs peer id looks good" '
66 PEERID=$(ipfs config Identity.PeerID) &&
63 - echo $PEERID | tr -dC "[:alnum:]" | wc -c | tr -d " " >actual_peerid &&
64 - echo "46" >expected_peerid &&
65 - test_cmp expected_peerid actual_peerid
67 + test_check_peerid "$PEERID"
68 '
69
70 test_expect_success "ipfs init output looks good" '
@@ -90,9 +92,7 @@ test_expect_success "'ipfs init --empty-repo' succeeds" '
92
93 test_expect_success "ipfs peer id looks good" '
94 PEERID=$(ipfs config Identity.PeerID) &&
93 - echo $PEERID | tr -dC "[:alnum:]" | wc -c | tr -d " " >actual_peerid &&
94 - echo "46" >expected_peerid &&
95 - test_cmp expected_peerid actual_peerid
95 + test_check_peerid "$PEERID"
96 '
97
98 test_expect_success "'ipfs init --empty-repo' output looks good" '