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
interface-go-dms3-core
Commits
aa64f771
Commit
aa64f771
authored
Dec 20, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: make sure to cancel context in tests
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
1532d260
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
165 additions
and
66 deletions
+165
-66
tests/api.go
tests/api.go
+36
-1
tests/block.go
tests/block.go
+12
-6
tests/dag.go
tests/dag.go
+10
-5
tests/dht.go
tests/dht.go
+6
-3
tests/key.go
tests/key.go
+32
-16
tests/name.go
tests/name.go
+6
-3
tests/object.go
tests/object.go
+24
-12
tests/path.go
tests/path.go
+10
-5
tests/pin.go
tests/pin.go
+6
-3
tests/unixfs.go
tests/unixfs.go
+23
-12
No files found.
tests/api.go
View file @
aa64f771
...
...
@@ -3,6 +3,7 @@ package tests
import
(
"context"
"testing"
"time"
coreiface
"github.com/ipfs/go-ipfs/core/coreapi/interface"
)
...
...
@@ -21,12 +22,37 @@ type Provider interface {
MakeAPISwarm
(
ctx
context
.
Context
,
fullIdentity
bool
,
n
int
)
([]
coreiface
.
CoreAPI
,
error
)
}
func
(
tp
*
provider
)
MakeAPISwarm
(
ctx
context
.
Context
,
fullIdentity
bool
,
n
int
)
([]
coreiface
.
CoreAPI
,
error
)
{
tp
.
apis
<-
1
go
func
()
{
<-
ctx
.
Done
()
tp
.
apis
<-
-
1
}()
return
tp
.
Provider
.
MakeAPISwarm
(
ctx
,
fullIdentity
,
n
)
}
type
provider
struct
{
Provider
apis
chan
int
}
func
TestApi
(
p
Provider
)
func
(
t
*
testing
.
T
)
{
tp
:=
&
provider
{
p
}
running
:=
1
apis
:=
make
(
chan
int
)
zeroRunning
:=
make
(
chan
struct
{})
go
func
()
{
for
i
:=
range
apis
{
running
+=
i
if
running
<
1
{
close
(
zeroRunning
)
return
}
}
}()
tp
:=
&
provider
{
Provider
:
p
,
apis
:
apis
}
return
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"Block"
,
tp
.
TestBlock
)
...
...
@@ -39,5 +65,14 @@ func TestApi(p Provider) func(t *testing.T) {
t
.
Run
(
"Pin"
,
tp
.
TestPin
)
t
.
Run
(
"PubSub"
,
tp
.
TestPubSub
)
t
.
Run
(
"Unixfs"
,
tp
.
TestUnixfs
)
apis
<-
-
1
t
.
Run
(
"TestsCancelCtx"
,
func
(
t
*
testing
.
T
)
{
select
{
case
<-
zeroRunning
:
case
<-
time
.
After
(
time
.
Second
)
:
t
.
Errorf
(
"%d node(s) not closed"
,
running
)
}
})
}
}
tests/block.go
View file @
aa64f771
...
...
@@ -22,7 +22,8 @@ func (tp *provider) TestBlock(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockPut
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -39,7 +40,8 @@ func (tp *provider) TestBlockPut(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockPutFormat
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -56,7 +58,8 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockPutHash
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -73,7 +76,8 @@ func (tp *provider) TestBlockPutHash(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockGet
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -113,7 +117,8 @@ func (tp *provider) TestBlockGet(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockRm
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -166,7 +171,8 @@ func (tp *provider) TestBlockRm(t *testing.T) {
}
func
(
tp
*
provider
)
TestBlockStat
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
tests/dag.go
View file @
aa64f771
...
...
@@ -31,7 +31,8 @@ var (
)
func
(
tp
*
provider
)
TestPut
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -48,7 +49,8 @@ func (tp *provider) TestPut(t *testing.T) {
}
func
(
tp
*
provider
)
TestPutWithHash
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -65,7 +67,8 @@ func (tp *provider) TestPutWithHash(t *testing.T) {
}
func
(
tp
*
provider
)
TestDagPath
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -97,7 +100,8 @@ func (tp *provider) TestDagPath(t *testing.T) {
}
func
(
tp
*
provider
)
TestTree
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -126,7 +130,8 @@ func (tp *provider) TestTree(t *testing.T) {
}
func
(
tp
*
provider
)
TestBatch
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
tests/dht.go
View file @
aa64f771
...
...
@@ -15,7 +15,8 @@ func (tp *provider) TestDht(t *testing.T) {
}
func
(
tp
*
provider
)
TestDhtFindPeer
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -51,7 +52,8 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) {
}
func
(
tp
*
provider
)
TestDhtFindProviders
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -80,7 +82,8 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) {
}
func
(
tp
*
provider
)
TestDhtProvide
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
tests/key.go
View file @
aa64f771
...
...
@@ -28,7 +28,8 @@ func (tp *provider) TestKey(t *testing.T) {
}
func
(
tp
*
provider
)
TestListSelf
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -61,7 +62,8 @@ func (tp *provider) TestListSelf(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameSelf
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -88,7 +90,8 @@ func (tp *provider) TestRenameSelf(t *testing.T) {
}
func
(
tp
*
provider
)
TestRemoveSelf
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -106,7 +109,8 @@ func (tp *provider) TestRemoveSelf(t *testing.T) {
}
func
(
tp
*
provider
)
TestGenerate
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -128,7 +132,8 @@ func (tp *provider) TestGenerate(t *testing.T) {
}
func
(
tp
*
provider
)
TestGenerateSize
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -150,7 +155,8 @@ func (tp *provider) TestGenerateSize(t *testing.T) {
}
func
(
tp
*
provider
)
TestGenerateType
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
t
.
Skip
(
"disabled until libp2p/specs#111 is fixed"
)
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -175,7 +181,8 @@ func (tp *provider) TestGenerateType(t *testing.T) {
}
func
(
tp
*
provider
)
TestGenerateExisting
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -207,7 +214,8 @@ func (tp *provider) TestGenerateExisting(t *testing.T) {
}
func
(
tp
*
provider
)
TestList
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -252,7 +260,8 @@ func (tp *provider) TestList(t *testing.T) {
}
func
(
tp
*
provider
)
TestRename
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -280,7 +289,8 @@ func (tp *provider) TestRename(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameToSelf
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -303,7 +313,8 @@ func (tp *provider) TestRenameToSelf(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameToSelfForce
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -326,7 +337,8 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameOverwriteNoForce
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -355,7 +367,8 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameOverwrite
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -393,7 +406,8 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameSameNameNoForce
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -421,7 +435,8 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) {
}
func
(
tp
*
provider
)
TestRenameSameName
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -449,7 +464,8 @@ func (tp *provider) TestRenameSameName(t *testing.T) {
}
func
(
tp
*
provider
)
TestRemove
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
tests/name.go
View file @
aa64f771
...
...
@@ -36,7 +36,8 @@ func appendPath(p coreiface.Path, sub string) coreiface.Path {
}
func
(
tp
*
provider
)
TestPublishResolve
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
init
:=
func
()
(
coreiface
.
CoreAPI
,
coreiface
.
Path
)
{
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
...
...
@@ -185,7 +186,8 @@ func (tp *provider) TestPublishResolve(t *testing.T) {
}
func
(
tp
*
provider
)
TestBasicPublishResolveKey
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -228,7 +230,8 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) {
func
(
tp
*
provider
)
TestBasicPublishResolveTimeout
(
t
*
testing
.
T
)
{
t
.
Skip
(
"ValidTime doesn't appear to work at this time resolution"
)
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
tests/object.go
View file @
aa64f771
...
...
@@ -28,7 +28,8 @@ func (tp *provider) TestObject(t *testing.T) {
}
func
(
tp
*
provider
)
TestNew
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -54,7 +55,8 @@ func (tp *provider) TestNew(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectPut
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -94,7 +96,8 @@ func (tp *provider) TestObjectPut(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectGet
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -116,7 +119,8 @@ func (tp *provider) TestObjectGet(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectData
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -143,7 +147,8 @@ func (tp *provider) TestObjectData(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectLinks
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -178,7 +183,8 @@ func (tp *provider) TestObjectLinks(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectStat
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -225,7 +231,8 @@ func (tp *provider) TestObjectStat(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectAddLink
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -265,7 +272,8 @@ func (tp *provider) TestObjectAddLink(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectAddLinkCreate
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -313,7 +321,8 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectRmLink
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -345,7 +354,8 @@ func (tp *provider) TestObjectRmLink(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectAddData
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -374,7 +384,8 @@ func (tp *provider) TestObjectAddData(t *testing.T) {
}
func
(
tp
*
provider
)
TestObjectSetData
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -403,7 +414,8 @@ func (tp *provider) TestObjectSetData(t *testing.T) {
}
func
(
tp
*
provider
)
TestDiffTest
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
tests/path.go
View file @
aa64f771
...
...
@@ -18,7 +18,8 @@ func (tp *provider) TestPath(t *testing.T) {
}
func
(
tp
*
provider
)
TestMutablePath
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -45,7 +46,8 @@ func (tp *provider) TestMutablePath(t *testing.T) {
}
func
(
tp
*
provider
)
TestPathRemainder
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -72,7 +74,8 @@ func (tp *provider) TestPathRemainder(t *testing.T) {
}
func
(
tp
*
provider
)
TestEmptyPathRemainder
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -103,7 +106,8 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
}
func
(
tp
*
provider
)
TestInvalidPathRemainder
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -126,7 +130,8 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
}
func
(
tp
*
provider
)
TestPathRoot
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
tests/pin.go
View file @
aa64f771
...
...
@@ -15,7 +15,8 @@ func (tp *provider) TestPin(t *testing.T) {
}
func
(
tp
*
provider
)
TestPinAdd
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -33,7 +34,8 @@ func (tp *provider) TestPinAdd(t *testing.T) {
}
func
(
tp
*
provider
)
TestPinSimple
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -82,7 +84,8 @@ func (tp *provider) TestPinSimple(t *testing.T) {
}
func
(
tp
*
provider
)
TestPinRecursive
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
tests/unixfs.go
View file @
aa64f771
...
...
@@ -79,7 +79,8 @@ func wrapped(name string) func(f files.Node) files.Node {
}
func
(
tp
*
provider
)
TestAdd
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -536,7 +537,8 @@ func (tp *provider) TestAdd(t *testing.T) {
}
func
(
tp
*
provider
)
TestAddPinned
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -558,7 +560,8 @@ func (tp *provider) TestAddPinned(t *testing.T) {
}
func
(
tp
*
provider
)
TestAddHashOnly
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -583,7 +586,8 @@ func (tp *provider) TestAddHashOnly(t *testing.T) {
}
func
(
tp
*
provider
)
TestGetEmptyFile
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -615,7 +619,8 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) {
}
func
(
tp
*
provider
)
TestGetDir
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -647,7 +652,8 @@ func (tp *provider) TestGetDir(t *testing.T) {
}
func
(
tp
*
provider
)
TestGetNonUnixfs
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -666,7 +672,8 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) {
}
func
(
tp
*
provider
)
TestLs
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -702,7 +709,8 @@ func (tp *provider) TestLs(t *testing.T) {
}
func
(
tp
*
provider
)
TestEntriesExpired
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -718,7 +726,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) {
t
.
Error
(
err
)
}
ctx
,
cancel
:
=
context
.
WithCancel
(
ctx
)
ctx
,
cancel
=
context
.
WithCancel
(
ctx
)
nd
,
err
:=
api
.
Unixfs
()
.
Get
(
ctx
,
p
)
if
err
!=
nil
{
...
...
@@ -745,7 +753,8 @@ func (tp *provider) TestEntriesExpired(t *testing.T) {
}
func
(
tp
*
provider
)
TestLsEmptyDir
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -773,7 +782,8 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) {
// TODO(lgierth) this should test properly, with len(links) > 0
func
(
tp
*
provider
)
TestLsNonUnixfs
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
@@ -830,7 +840,8 @@ func (f *closeTestF) Close() error {
}
func
(
tp
*
provider
)
TestAddCloses
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
...
...
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