t0020: add test for --empty-repo
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Aug 25, 2015 at 20:15 UTC
872daf8357ced1dbb4f019619dec25deef06a6b9
1 file changed
+31
test/sharness/t0020-init.sh
+31
@@ -75,6 +75,37 @@ test_expect_success "ipfs init output looks good" '
75
test_cmp expected actual_init
76
'
77
78
+test_expect_success "Welcome readme exists" '
79
+ ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme
80
+'
81
+
82
+test_expect_success "clean up ipfs dir" '
83
+ rm -rf "$IPFS_PATH"
84
+'
85
+
86
+test_expect_success "'ipfs init --empty-repo' succeeds" '
87
+ BITS="1024" &&
88
+ ipfs init --bits="$BITS" --empty-repo >actual_init
89
+'
90
+
91
+test_expect_success "ipfs peer id looks good" '
92
+ 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
96
+'
97
+
98
+test_expect_success "'ipfs init --empty-repo' output looks good" '
99
+ echo "initializing ipfs node at $IPFS_PATH" >expected &&
100
+ echo "generating $BITS-bit RSA keypair...done" >>expected &&
101
+ echo "peer identity: $PEERID" >>expected &&
102
+ test_cmp expected actual_init
103
+'
104
+
105
+test_expect_success "Welcome readme doesn't exists" '
106
+ test_must_fail ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme
107
+'
108
+
109
test_expect_success "clean up ipfs dir" '
110
rm -rf "$IPFS_PATH"
111
'