@@ -8,6 +8,52 @@ test_description="Test daemon command"
8
8
9
9
. lib/test-lib.sh
10
10
11
+ test_expect_success " daemon init with existing config works" '
12
+ export ORIG_PATH=$(pwd)/.ipfs &&
13
+ export CLONE_PATH=$(pwd)/.ipfs-clone &&
14
+ ipfs init --profile=badgerds &&
15
+ export IPFS_PATH=$CLONE_PATH
16
+ ipfs daemon --init --init-config-file=$ORIG_PATH/config &
17
+ IPFS_PID=$!
18
+ test_wait_for_file 20 100ms "$IPFS_PATH/api" &&
19
+ test_kill_ipfs_daemon &&
20
+ ipfs config "Datastore.Spec.child.path" >actual &&
21
+ test $(cat actual) = "badgerds"
22
+ '
23
+
24
+ test_expect_success " clean up daemon clone" '
25
+ rm -rf $CLONE_PATH
26
+ '
27
+
28
+ test_expect_fail " daemon init with existing config and profiles work" '
29
+ ipfs daemon --init --init-config-file=$ORIG_PATH/config --profile=randomports &
30
+ IPFS_PID=$!
31
+ test_wait_for_file 20 100ms "$IPFS_PATH/api" &&
32
+ test_kill_ipfs_daemon &&
33
+ ipfs config Addresses >clone_conf &&
34
+ IPFS_PATH=$ORIG_PATH &&
35
+ ipfs config Addresses >orig_conf &&
36
+ test_cmp clone_conf orig_conf
37
+ '
38
+
39
+ test_expect_success " clean up second daemon clone and source daemon" '
40
+ rm -rf $CLONE_PATH
41
+ rm -rf $ORIG_PATH
42
+ '
43
+
44
+ test_expect_success " daemon init with existing config works" '
45
+ export ORIG_PATH=$IPFS_PATH &&
46
+ export CLONE_PATH=$(pwd)/.ipfs-clone &&
47
+ ipfs init --profile=badgerds &&
48
+ export IPFS_PATH=$CLONE_PATH
49
+ ipfs daemon --init --init-config-file=$ORIG_PATH/config &
50
+ IPFS_PID=$!
51
+ test_wait_for_file 20 100ms "$IPFS_PATH/api" &&
52
+ echo "badgerds" >expected &&
53
+ ipfs config "Datastore.Spec.child.path" >actual &&
54
+ test_kill_ipfs_daemon &&
55
+ test_cmp expected actual
56
+ '
11
57
12
58
test_init_ipfs
13
59
test_launch_ipfs_daemon
0 commit comments