Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit f7c0df2

Browse files
authored
Merge pull request #520 from ipfs/add-passing-t0022-tests
sharness: add t0022-init-default.sh
2 parents c206908 + 13d4ec0 commit f7c0df2

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/sharness/t0022-init-default.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2014 Christian Couder
4+
# MIT Licensed; see the LICENSE file in this repository.
5+
#
6+
7+
test_description="Test init command with default config"
8+
9+
. lib/test-lib.sh
10+
11+
cfg_key="Addresses.API"
12+
cfg_val="/ip4/0.0.0.0/tcp/5001"
13+
14+
# test that init succeeds
15+
test_expect_success "ipfs init succeeds" '
16+
export IPFS_PATH="$(pwd)/.ipfs" &&
17+
echo "IPFS_PATH: \"$IPFS_PATH\"" &&
18+
BITS="2048" &&
19+
ipfs init --bits="$BITS" >actual_init ||
20+
test_fsh cat actual_init
21+
'
22+
23+
test_expect_success ".ipfs/config has been created" '
24+
test -f "$IPFS_PATH"/config ||
25+
test_fsh ls -al .ipfs
26+
'
27+
28+
test_expect_success "ipfs config succeeds" '
29+
ipfs config $cfg_flags "$cfg_key" "$cfg_val"
30+
'
31+
32+
test_expect_success "ipfs read config succeeds" '
33+
IPFS_DEFAULT_CONFIG=$(cat "$IPFS_PATH"/config)
34+
'
35+
36+
test_expect_success "clean up ipfs dir" '
37+
rm -rf "$IPFS_PATH"
38+
'
39+
40+
test_expect_success "ipfs init default config succeeds" '
41+
echo $IPFS_DEFAULT_CONFIG | ipfs init - >actual_init ||
42+
test_fsh cat actual_init
43+
'
44+
45+
test_done

0 commit comments

Comments
 (0)