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-blockservice
Commits
2bb63900
Commit
2bb63900
authored
Mar 23, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix lint
parent
3e11d014
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
blockservice_test.go
blockservice_test.go
+16
-5
test/blocks_test.go
test/blocks_test.go
+4
-1
No files found.
blockservice_test.go
View file @
2bb63900
...
@@ -26,12 +26,18 @@ func TestWriteThroughWorks(t *testing.T) {
...
@@ -26,12 +26,18 @@ func TestWriteThroughWorks(t *testing.T) {
block
:=
bgen
.
Next
()
block
:=
bgen
.
Next
()
t
.
Logf
(
"PutCounter: %d"
,
bstore
.
PutCounter
)
t
.
Logf
(
"PutCounter: %d"
,
bstore
.
PutCounter
)
bserv
.
AddBlock
(
block
)
err
:=
bserv
.
AddBlock
(
block
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
bstore
.
PutCounter
!=
1
{
if
bstore
.
PutCounter
!=
1
{
t
.
Fatalf
(
"expected just one Put call, have: %d"
,
bstore
.
PutCounter
)
t
.
Fatalf
(
"expected just one Put call, have: %d"
,
bstore
.
PutCounter
)
}
}
bserv
.
AddBlock
(
block
)
err
=
bserv
.
AddBlock
(
block
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
bstore
.
PutCounter
!=
2
{
if
bstore
.
PutCounter
!=
2
{
t
.
Fatalf
(
"Put should have called again, should be 2 is: %d"
,
bstore
.
PutCounter
)
t
.
Fatalf
(
"Put should have called again, should be 2 is: %d"
,
bstore
.
PutCounter
)
}
}
...
@@ -52,10 +58,15 @@ func TestLazySessionInitialization(t *testing.T) {
...
@@ -52,10 +58,15 @@ func TestLazySessionInitialization(t *testing.T) {
bgen
:=
butil
.
NewBlockGenerator
()
bgen
:=
butil
.
NewBlockGenerator
()
block
:=
bgen
.
Next
()
block
:=
bgen
.
Next
()
bstore
.
Put
(
block
)
err
:=
bstore
.
Put
(
block
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
block2
:=
bgen
.
Next
()
block2
:=
bgen
.
Next
()
session
.
HasBlock
(
block2
)
err
=
session
.
HasBlock
(
block2
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
bsession
:=
NewSession
(
ctx
,
bservSessEx
)
bsession
:=
NewSession
(
ctx
,
bservSessEx
)
if
bsession
.
ses
!=
nil
{
if
bsession
.
ses
!=
nil
{
...
...
test/blocks_test.go
View file @
2bb63900
...
@@ -74,7 +74,10 @@ func TestGetBlocksSequential(t *testing.T) {
...
@@ -74,7 +74,10 @@ func TestGetBlocksSequential(t *testing.T) {
var
cids
[]
cid
.
Cid
var
cids
[]
cid
.
Cid
for
_
,
o
:=
range
objs
{
for
_
,
o
:=
range
objs
{
cids
=
append
(
cids
,
o
.
Cid
())
cids
=
append
(
cids
,
o
.
Cid
())
servs
[
0
]
.
AddBlock
(
o
)
err
:=
servs
[
0
]
.
AddBlock
(
o
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
}
t
.
Log
(
"one instance at a time, get blocks concurrently"
)
t
.
Log
(
"one instance at a time, get blocks concurrently"
)
...
...
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