Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
ce77b1df
Commit
ce77b1df
authored
Jan 05, 2017
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak TestStorage tests.
parent
ef9568aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
19 deletions
+14
-19
flatfs_test.go
flatfs_test.go
+14
-19
No files found.
flatfs_test.go
View file @
ce77b1df
...
...
@@ -2,7 +2,6 @@ package flatfs_test
import
(
"encoding/base32"
"fmt"
"io/ioutil"
"math"
"math/rand"
...
...
@@ -153,10 +152,9 @@ func testGetNotFoundError(dirFunc string, t *testing.T) {
func
TestGetNotFoundError
(
t
*
testing
.
T
)
{
tryAllShardFuncs
(
t
,
testGetNotFoundError
)
}
type
params
struct
{
what
string
dir
string
key
string
dirFunc
string
shard
string
dir
string
key
string
}
func
testStorage
(
p
*
params
,
t
*
testing
.
T
)
{
...
...
@@ -164,7 +162,7 @@ func testStorage(p *params, t *testing.T) {
defer
cleanup
()
target
:=
p
.
dir
+
string
(
os
.
PathSeparator
)
+
p
.
key
+
".data"
fs
,
err
:=
flatfs
.
New
(
temp
,
fmt
.
Sprintf
(
"%s/%d"
,
p
.
dirFunc
,
len
(
p
.
dir
))
,
false
)
fs
,
err
:=
flatfs
.
New
(
temp
,
p
.
shard
,
false
)
if
err
!=
nil
{
t
.
Fatalf
(
"New fail: %v
\n
"
,
err
)
}
...
...
@@ -195,7 +193,7 @@ func testStorage(p *params, t *testing.T) {
haveREADME
=
true
case
p
.
dir
:
if
!
fi
.
IsDir
()
{
t
.
Errorf
(
"
%s
directory is not a file? %v"
,
p
.
what
,
fi
.
Mode
())
t
.
Errorf
(
"directory is not a file? %v"
,
fi
.
Mode
())
}
// we know it's there if we see the file, nothing more to
// do here
...
...
@@ -230,26 +228,23 @@ func testStorage(p *params, t *testing.T) {
func
TestStorage
(
t
*
testing
.
T
)
{
t
.
Run
(
"prefix"
,
func
(
t
*
testing
.
T
)
{
testStorage
(
&
params
{
what
:
"prefix"
,
dir
:
"qu"
,
key
:
"quux"
,
dirFunc
:
"prefix"
,
shard
:
"v1/prefix/2"
,
dir
:
"qu"
,
key
:
"quux"
,
},
t
)
})
t
.
Run
(
"suffix"
,
func
(
t
*
testing
.
T
)
{
testStorage
(
&
params
{
what
:
"suffix"
,
dir
:
"ux"
,
key
:
"quux"
,
dirFunc
:
"suffix"
,
shard
:
"v1/suffix/2"
,
dir
:
"ux"
,
key
:
"quux"
,
},
t
)
})
t
.
Run
(
"next-to-last"
,
func
(
t
*
testing
.
T
)
{
testStorage
(
&
params
{
what
:
"next-to-last"
,
dir
:
"uu"
,
key
:
"quux"
,
dirFunc
:
"next-to-last"
,
shard
:
flatfs
.
IPFS_DEF_SHARD
,
dir
:
"uu"
,
key
:
"quux"
,
},
t
)
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment