drop --name test file and update test case
License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com>
Kejie Zhang committed
Sep 6, 2018 at 21:26 UTC
76e8190a382efdbad882446d022ce37881b93f4a
3 files changed
+24
-79
cmd/ipfs/daemon.go
+3
-3
@@ -287,9 +287,9 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
287
288
// Start assembling node config
289
ncfg := &core.BuildCfg{
290
- Repo: repo,
291
- Permanent: true, // It is temporary way to signify that node is permanent
292
- Online: !offline,
290
+ Repo: repo,
291
+ Permanent: true, // It is temporary way to signify that node is permanent
292
+ Online: !offline,
293
DisableEncryptedConnections: unencrypted,
294
ExtraOpts: map[string]bool{
295
"pubsub": pubsub,
test/sharness/t0040-add-and-cat.sh
+21
@@ -184,6 +184,27 @@ test_add_cat_file() {
184
test_expect_success "make sure it looks good" '
185
test_cmp zero-length-file zero-length-file_out
186
'
187
+
188
+ test_expect_success "ipfs add --name" '
189
+ HASH="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
190
+ echo "IPFS" | ipfs add --name file.txt > actual &&
191
+ echo "added $HASH file.txt" > expected &&
192
+ test_cmp expected actual
193
+ '
194
+
195
+ test_expect_success "ipfs add --name -w" '
196
+ HASH1="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
197
+ echo "IPFS" | ipfs add -w --name file.txt | head -n1> actual &&
198
+ echo "added $HASH1 file.txt" > expected &&
199
+ test_cmp expected actual
200
+ '
201
+
202
+ test_expect_success "ipfs cat with name" '
203
+ HASH=$(echo "IPFS" | ipfs add -w --name file.txt -Q) &&
204
+ ipfs cat /ipfs/$HASH/file.txt > expected &&
205
+ echo "IPFS" > actual &&
206
+ test_cmp expected actual
207
+ '
208
}
209
210
test_add_cat_5MB() {
test/sharness/t0047-add-name.sh
deleted
-76
@@ -1,76 +0,0 @@
1
-#!/usr/bin/env bash
2
-#
3
-# Copyright (c) 2018 Kejie Zhang
4
-# MIT Licensed; see the LICENSE file in this repository.
5
-#
6
-
7
-test_description="Test add --name"
8
-
9
-add_name_m='QmazHkwx6mPmmCEi1jR5YzjjQd1g5XzKfYQLzRAg7x5uUk'
10
-
11
-add_name_1='added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu 4r93'
12
-
13
-add_name_2='added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu 4r93
14
-added Qmf82PSsMpUHcrqxa69KG6Qp5yeK7K9BTizXgG3nvzWcNG '
15
-
16
-add_name_3='added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu myfile.txt
17
-added QmZbStPUUoRr1hA9GZyKx7pyskZvCczPrf6XSK6A9HSr1i '
18
-
19
-add_name_4='added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu myfile.txt'
20
-
21
-. lib/test-lib.sh
22
-
23
-test_add_name() {
24
-
25
- test_expect_success "go-random-files is installed" '
26
- type random-files
27
- '
28
-
29
- test_expect_success "random-files generates test files" '
30
- random-files --seed 7547632 --files 5 --dirs 2 --depth 3 m &&
31
- echo "$add_name_m" >expected &&
32
- ipfs add -q -r m | tail -n1 >actual &&
33
- echo $actual
34
- test_sort_cmp expected actual
35
- '
36
-
37
- # test --name without -w
38
- test_expect_success "ipfs add --name is correct" '
39
- echo "$add_name_1" >expected &&
40
- ipfs add m/4r93 --name myfile.txt >actual
41
- test_sort_cmp expected actual
42
- '
43
-
44
- # test --name with -w
45
- test_expect_success "ipfs add -w --name is correct" '
46
- echo "$add_name_2" >expected &&
47
- ipfs add m/4r93 -w --name myfile.txt >actual
48
- test_sort_cmp expected actual
49
- '
50
-
51
- # test --name with -w and cat
52
- test_expect_success "cat file | ipfs add -w --name is correct" '
53
- echo "$add_name_3" >expected &&
54
- cat m/4r93 | ipfs add -w --name myfile.txt >actual
55
- test_sort_cmp expected actual
56
- '
57
-
58
- # test --name with cat but without -w
59
- test_expect_success "cat file | ipfs add --name is correct" '
60
- echo "$add_name_4" >expected &&
61
- cat m/4r93 | ipfs add --name myfile.txt >actual
62
- test_sort_cmp expected actual
63
- '
64
-}
65
-
66
-test_init_ipfs
67
-
68
-test_add_name
69
-
70
-test_launch_ipfs_daemon
71
-
72
-test_add_name
73
-
74
-test_kill_ipfs_daemon
75
-
76
-test_done