update tests, and ensure 'default' blocks are pinned
Jeromy committed
Jan 22, 2015 at 00:16 UTC
1244fd251d671a738bf0d1d8b8f581a1444aec2e
3 files changed
+37
-9
fuse/ipns/ipns_unix.go
+10
@@ -42,6 +42,16 @@ func InitializeKeyspace(n *core.IpfsNode, key ci.PrivKey) error {
42
return err
43
}
44
45
+ err = n.Pinning.Pin(emptyDir, false)
46
+ if err != nil {
47
+ return err
48
+ }
49
+
50
+ err = n.Pinning.Flush()
51
+ if err != nil {
52
+ return err
53
+ }
54
+
55
pub := nsys.NewRoutingPublisher(n.Routing)
56
err = pub.Publish(key, k.B58String())
57
if err != nil {
importer/importer.go
+4
@@ -200,6 +200,10 @@ func BuildDagFromReader(r io.Reader, ds dag.DAGService, mp pin.ManualPinner, spl
200
201
if mp != nil {
202
mp.PinWithMode(rootkey, pin.Recursive)
203
+ err := mp.Flush()
204
+ if err != nil {
205
+ return nil, err
206
+ }
207
}
208
209
return root.getDagNode()
test/sharness/t0080-repo.sh
+23
-9
@@ -21,10 +21,16 @@ test_expect_success "added file was pinned" '
21
ipfs pin ls -type=recursive | grep $HASH
22
'
23
24
-test_expect_success "'ipfs repo gc' doesnt remove file" '
25
- echo -n "" > empty
24
+test_expect_success "'ipfs repo gc' succeeds" '
25
ipfs repo gc > gc_out_actual
26
+'
27
+
28
+test_expect_success "'ipfs repo gc' looks good (empty)" '
29
+ echo -n "" > empty
30
test_cmp empty gc_out_actual
31
+'
32
+
33
+test_expect_success "'ipfs repo gc' doesnt remove file" '
34
ipfs cat $HASH > out
35
test_cmp out afile
36
'
@@ -36,8 +42,10 @@ test_expect_success "'ipfs pin rm' succeeds" '
42
'
43
44
test_expect_success "file no longer pinned" '
45
+ # we expect the welcome file to show up here
46
+ echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB > expected2
47
ipfs pin ls -type=recursive > actual2
40
- test_cmp empty actual2
48
+ test_cmp expected2 actual2
49
'
50
51
test_expect_success "recursively pin afile" '
@@ -76,8 +84,10 @@ test_expect_success "'ipfs repo gc' removes file" '
84
'
85
86
test_expect_success "'ipfs refs local' no longer shows file" '
87
+ echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > expected8
88
+ echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> expected8
89
ipfs refs local > actual8
80
- test_cmp empty actual8
90
+ test_cmp expected8 actual8
91
'
92
93
test_expect_success "adding multiblock random file succeeds" '
@@ -104,15 +114,19 @@ test_expect_success "pin something directly" '
114
'
115
116
test_expect_success "'ipfs pin ls -type=direct' is correct" '
107
- echo $DIRECTPIN > directpinhash
108
- ipfs pin ls -type=direct > directpinout
109
- test_cmp directpinhash directpinout
117
+ echo $DIRECTPIN > directpinexpected
118
+ echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >> directpinexpected
119
+ cat directpinexpected | sort > dp_exp_sorted
120
+ ipfs pin ls -type=direct | sort > directpinout
121
+ test_cmp dp_exp_sorted directpinout
122
'
123
124
test_expect_success "'ipfs pin ls -type=recursive' is correct" '
125
echo $MBLOCKHASH > rp_expected
114
- ipfs pin ls -type=recursive > rp_actual
115
- test_cmp rp_expected rp_actual
126
+ echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> rp_expected
127
+ cat rp_expected | sort > rp_exp_sorted
128
+ ipfs pin ls -type=recursive | sort > rp_actual
129
+ test_cmp rp_exp_sorted rp_actual
130
'
131
132
test_expect_success "'ipfs pin ls -type=all' is correct" '