@@ -27,6 +27,8 @@ func TestPut(t *testing.T) {
2727 t .Errorf ("#%d: data = %s, want %s" , i , v .data , tt .data )
2828 }
2929 }
30+
31+ b .testableCleanupResource ()
3032}
3133
3234func TestPutOnExistingPath (t * testing.T ) {
@@ -61,6 +63,7 @@ func TestPutOnExistingPath(t *testing.T) {
6163 t .Errorf ("#%d 2: data = %s, want %s" , i , v .data , tt .data2 )
6264 }
6365 }
66+ b .testableCleanupResource ()
6467}
6568
6669func TestGetMVCC (t * testing.T ) {
@@ -96,15 +99,16 @@ func TestGetMVCC(t *testing.T) {
9699 t .Errorf ("#%d: data = %s, want %s" , i , v .data , tt .data )
97100 }
98101 }
102+ b .testableCleanupResource ()
99103}
100104
101105func TestLs (t * testing.T ) {
102- back := newBackend ()
106+ b := newBackend ()
103107 d := []byte ("somedata" )
104- back .Put (1 , * newPath ("/a" ), d )
105- back .Put (2 , * newPath ("/a/b" ), d )
106- back .Put (3 , * newPath ("/a/c" ), d )
107- back .Put (4 , * newPath ("/b" ), d )
108+ b .Put (1 , * newPath ("/a" ), d )
109+ b .Put (2 , * newPath ("/a/b" ), d )
110+ b .Put (3 , * newPath ("/a/c" ), d )
111+ b .Put (4 , * newPath ("/b" ), d )
108112
109113 tests := []struct {
110114 p string
@@ -118,7 +122,7 @@ func TestLs(t *testing.T) {
118122 {"/c" , []string {}},
119123 }
120124 for i , tt := range tests {
121- ps := back .Ls (tt .p )
125+ ps := b .Ls (tt .p )
122126 if len (ps ) != len (tt .wps ) {
123127 t .Fatalf ("#%d: len(ps) = %d, want %d" , i , len (ps ), len (tt .wps ))
124128 }
@@ -128,6 +132,10 @@ func TestLs(t *testing.T) {
128132 }
129133 }
130134 }
135+ b .testableCleanupResource ()
136+ }
137+
138+ func TestRestore (t * testing.T ) {
131139}
132140
133141func BenchmarkPut (b * testing.B ) {
@@ -143,6 +151,7 @@ func BenchmarkPut(b *testing.B) {
143151 for i := 1 ; i < b .N ; i ++ {
144152 back .Put (i , path [i ], d )
145153 }
154+ back .testableCleanupResource ()
146155}
147156
148157func BenchmarkGetWithCache (b * testing.B ) {
@@ -163,6 +172,7 @@ func BenchmarkGetWithCache(b *testing.B) {
163172 back .Get (i , path [i ])
164173 }
165174 }
175+ back .testableCleanupResource ()
166176}
167177
168178func BenchmarkGetWithOutCache (b * testing.B ) {
@@ -184,4 +194,5 @@ func BenchmarkGetWithOutCache(b *testing.B) {
184194 back .Get (i , path [i ])
185195 }
186196 }
197+ back .testableCleanupResource ()
187198}
0 commit comments