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
103b6454
Unverified
Commit
103b6454
authored
May 20, 2019
by
Łukasz Magiera
Committed by
GitHub
May 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from ipfs/feat/expose-tests
tests: expose TestSuite
parents
5d8d216d
6fe8577a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
90 additions
and
88 deletions
+90
-88
tests/api.go
tests/api.go
+12
-10
tests/block.go
tests/block.go
+8
-8
tests/dag.go
tests/dag.go
+6
-6
tests/dht.go
tests/dht.go
+4
-4
tests/key.go
tests/key.go
+17
-17
tests/name.go
tests/name.go
+4
-4
tests/object.go
tests/object.go
+13
-13
tests/path.go
tests/path.go
+7
-7
tests/pin.go
tests/pin.go
+4
-4
tests/pubsub.go
tests/pubsub.go
+2
-2
tests/unixfs.go
tests/unixfs.go
+13
-13
No files found.
tests/api.go
View file @
103b6454
...
...
@@ -11,7 +11,7 @@ import (
var
apiNotImplemented
=
errors
.
New
(
"api not implemented"
)
func
(
tp
*
provider
)
makeAPI
(
ctx
context
.
Context
)
(
coreiface
.
CoreAPI
,
error
)
{
func
(
tp
*
TestSuite
)
makeAPI
(
ctx
context
.
Context
)
(
coreiface
.
CoreAPI
,
error
)
{
api
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
false
,
1
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -25,17 +25,19 @@ 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
}()
func
(
tp
*
TestSuite
)
MakeAPISwarm
(
ctx
context
.
Context
,
fullIdentity
bool
,
n
int
)
([]
coreiface
.
CoreAPI
,
error
)
{
if
tp
.
apis
!=
nil
{
tp
.
apis
<-
1
go
func
()
{
<-
ctx
.
Done
()
tp
.
apis
<-
-
1
}()
}
return
tp
.
Provider
.
MakeAPISwarm
(
ctx
,
fullIdentity
,
n
)
}
type
provider
struct
{
type
TestSuite
struct
{
Provider
apis
chan
int
...
...
@@ -55,7 +57,7 @@ func TestApi(p Provider) func(t *testing.T) {
}
}()
tp
:=
&
provider
{
Provider
:
p
,
apis
:
apis
}
tp
:=
&
TestSuite
{
Provider
:
p
,
apis
:
apis
}
return
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"Block"
,
tp
.
TestBlock
)
...
...
@@ -80,7 +82,7 @@ func TestApi(p Provider) func(t *testing.T) {
}
}
func
(
tp
*
provider
)
hasApi
(
t
*
testing
.
T
,
tf
func
(
coreiface
.
CoreAPI
)
error
)
{
func
(
tp
*
TestSuite
)
hasApi
(
t
*
testing
.
T
,
tf
func
(
coreiface
.
CoreAPI
)
error
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/block.go
View file @
103b6454
...
...
@@ -13,7 +13,7 @@ import (
mh
"github.com/multiformats/go-multihash"
)
func
(
tp
*
provider
)
TestBlock
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlock
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
coreiface
.
CoreAPI
)
error
{
if
api
.
Block
()
==
nil
{
return
apiNotImplemented
...
...
@@ -30,7 +30,7 @@ func (tp *provider) TestBlock(t *testing.T) {
t
.
Run
(
"TestBlockPin"
,
tp
.
TestBlockPin
)
}
func
(
tp
*
provider
)
TestBlockPut
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockPut
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -48,7 +48,7 @@ func (tp *provider) TestBlockPut(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockPutFormat
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockPutFormat
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -66,7 +66,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockPutHash
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockPutHash
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -84,7 +84,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockGet
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockGet
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -122,7 +122,7 @@ func (tp *provider) TestBlockGet(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockRm
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockRm
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -176,7 +176,7 @@ func (tp *provider) TestBlockRm(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockStat
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockStat
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -203,7 +203,7 @@ func (tp *provider) TestBlockStat(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBlockPin
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBlockPin
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/dag.go
View file @
103b6454
...
...
@@ -15,7 +15,7 @@ import (
mh
"github.com/multiformats/go-multihash"
)
func
(
tp
*
provider
)
TestDag
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDag
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
coreiface
.
CoreAPI
)
error
{
if
api
.
Dag
()
==
nil
{
return
apiNotImplemented
...
...
@@ -40,7 +40,7 @@ var (
}
)
func
(
tp
*
provider
)
TestPut
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPut
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -63,7 +63,7 @@ func (tp *provider) TestPut(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPutWithHash
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPutWithHash
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -86,7 +86,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestDagPath
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDagPath
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -131,7 +131,7 @@ func (tp *provider) TestDagPath(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestTree
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestTree
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -166,7 +166,7 @@ func (tp *provider) TestTree(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBatch
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBatch
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/dht.go
View file @
103b6454
...
...
@@ -9,7 +9,7 @@ import (
"github.com/ipfs/interface-go-ipfs-core/options"
)
func
(
tp
*
provider
)
TestDht
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDht
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
iface
.
CoreAPI
)
error
{
if
api
.
Dht
()
==
nil
{
return
apiNotImplemented
...
...
@@ -22,7 +22,7 @@ func (tp *provider) TestDht(t *testing.T) {
t
.
Run
(
"TestDhtProvide"
,
tp
.
TestDhtProvide
)
}
func
(
tp
*
provider
)
TestDhtFindPeer
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDhtFindPeer
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
...
...
@@ -75,7 +75,7 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestDhtFindProviders
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDhtFindProviders
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
...
...
@@ -105,7 +105,7 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestDhtProvide
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDhtProvide
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
...
...
tests/key.go
View file @
103b6454
...
...
@@ -9,7 +9,7 @@ import (
opt
"github.com/ipfs/interface-go-ipfs-core/options"
)
func
(
tp
*
provider
)
TestKey
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestKey
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
iface
.
CoreAPI
)
error
{
if
api
.
Key
()
==
nil
{
return
apiNotImplemented
...
...
@@ -35,7 +35,7 @@ func (tp *provider) TestKey(t *testing.T) {
t
.
Run
(
"TestRemove"
,
tp
.
TestRemove
)
}
func
(
tp
*
provider
)
TestListSelf
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestListSelf
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -69,7 +69,7 @@ func (tp *provider) TestListSelf(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameSelf
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameSelf
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -97,7 +97,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRemoveSelf
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRemoveSelf
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -116,7 +116,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGenerate
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestGenerate
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -139,7 +139,7 @@ func (tp *provider) TestGenerate(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGenerateSize
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestGenerateSize
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -162,7 +162,7 @@ func (tp *provider) TestGenerateSize(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGenerateType
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestGenerateType
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
t
.
Skip
(
"disabled until libp2p/specs#111 is fixed"
)
...
...
@@ -188,7 +188,7 @@ func (tp *provider) TestGenerateType(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGenerateExisting
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestGenerateExisting
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -221,7 +221,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestList
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestList
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -267,7 +267,7 @@ func (tp *provider) TestList(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRename
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRename
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -296,7 +296,7 @@ func (tp *provider) TestRename(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameToSelf
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameToSelf
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -320,7 +320,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameToSelfForce
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameToSelfForce
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -344,7 +344,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameOverwriteNoForce
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameOverwriteNoForce
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -374,7 +374,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameOverwrite
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameOverwrite
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -413,7 +413,7 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameSameNameNoForce
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameSameNameNoForce
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -442,7 +442,7 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRenameSameName
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRenameSameName
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -471,7 +471,7 @@ func (tp *provider) TestRenameSameName(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestRemove
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestRemove
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/name.go
View file @
103b6454
...
...
@@ -16,7 +16,7 @@ import (
opt
"github.com/ipfs/interface-go-ipfs-core/options"
)
func
(
tp
*
provider
)
TestName
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestName
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
coreiface
.
CoreAPI
)
error
{
if
api
.
Name
()
==
nil
{
return
apiNotImplemented
...
...
@@ -39,7 +39,7 @@ func appendPath(p path.Path, sub string) path.Path {
return
path
.
New
(
gopath
.
Join
(
p
.
String
(),
sub
))
}
func
(
tp
*
provider
)
TestPublishResolve
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPublishResolve
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
init
:=
func
()
(
coreiface
.
CoreAPI
,
path
.
Path
)
{
...
...
@@ -188,7 +188,7 @@ func (tp *provider) TestPublishResolve(t *testing.T) {
})
}
func
(
tp
*
provider
)
TestBasicPublishResolveKey
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBasicPublishResolveKey
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
apis
,
err
:=
tp
.
MakeAPISwarm
(
ctx
,
true
,
5
)
...
...
@@ -230,7 +230,7 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestBasicPublishResolveTimeout
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBasicPublishResolveTimeout
(
t
*
testing
.
T
)
{
t
.
Skip
(
"ValidTime doesn't appear to work at this time resolution"
)
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
...
...
tests/object.go
View file @
103b6454
...
...
@@ -12,7 +12,7 @@ import (
opt
"github.com/ipfs/interface-go-ipfs-core/options"
)
func
(
tp
*
provider
)
TestObject
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObject
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
iface
.
CoreAPI
)
error
{
if
api
.
Object
()
==
nil
{
return
apiNotImplemented
...
...
@@ -34,7 +34,7 @@ func (tp *provider) TestObject(t *testing.T) {
t
.
Run
(
"TestDiffTest"
,
tp
.
TestDiffTest
)
}
func
(
tp
*
provider
)
TestNew
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestNew
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -61,7 +61,7 @@ func (tp *provider) TestNew(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectPut
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectPut
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -102,7 +102,7 @@ func (tp *provider) TestObjectPut(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectGet
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectGet
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -125,7 +125,7 @@ func (tp *provider) TestObjectGet(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectData
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectData
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -153,7 +153,7 @@ func (tp *provider) TestObjectData(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectLinks
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectLinks
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -189,7 +189,7 @@ func (tp *provider) TestObjectLinks(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectStat
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectStat
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -237,7 +237,7 @@ func (tp *provider) TestObjectStat(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectAddLink
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectAddLink
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -278,7 +278,7 @@ func (tp *provider) TestObjectAddLink(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectAddLinkCreate
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectAddLinkCreate
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -327,7 +327,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectRmLink
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectRmLink
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -360,7 +360,7 @@ func (tp *provider) TestObjectRmLink(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectAddData
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectAddData
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -393,7 +393,7 @@ func (tp *provider) TestObjectAddData(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestObjectSetData
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestObjectSetData
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -426,7 +426,7 @@ func (tp *provider) TestObjectSetData(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestDiffTest
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestDiffTest
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/path.go
View file @
103b6454
...
...
@@ -12,7 +12,7 @@ import (
ipldcbor
"github.com/ipfs/go-ipld-cbor"
)
func
(
tp
*
provider
)
TestPath
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPath
(
t
*
testing
.
T
)
{
t
.
Run
(
"TestMutablePath"
,
tp
.
TestMutablePath
)
t
.
Run
(
"TestPathRemainder"
,
tp
.
TestPathRemainder
)
t
.
Run
(
"TestEmptyPathRemainder"
,
tp
.
TestEmptyPathRemainder
)
...
...
@@ -21,7 +21,7 @@ func (tp *provider) TestPath(t *testing.T) {
t
.
Run
(
"TestPathJoin"
,
tp
.
TestPathJoin
)
}
func
(
tp
*
provider
)
TestMutablePath
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestMutablePath
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -54,7 +54,7 @@ func (tp *provider) TestMutablePath(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPathRemainder
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPathRemainder
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -85,7 +85,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestEmptyPathRemainder
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestEmptyPathRemainder
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -116,7 +116,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestInvalidPathRemainder
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestInvalidPathRemainder
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -143,7 +143,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPathRoot
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPathRoot
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -187,7 +187,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPathJoin
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPathJoin
(
t
*
testing
.
T
)
{
p1
:=
path
.
New
(
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz"
)
if
path
.
Join
(
p1
,
"foo"
)
.
String
()
!=
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo"
{
...
...
tests/pin.go
View file @
103b6454
...
...
@@ -14,7 +14,7 @@ import (
ipld
"github.com/ipfs/go-ipld-format"
)
func
(
tp
*
provider
)
TestPin
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPin
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
iface
.
CoreAPI
)
error
{
if
api
.
Pin
()
==
nil
{
return
apiNotImplemented
...
...
@@ -27,7 +27,7 @@ func (tp *provider) TestPin(t *testing.T) {
t
.
Run
(
"TestPinRecursive"
,
tp
.
TestPinRecursive
)
}
func
(
tp
*
provider
)
TestPinAdd
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPinAdd
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -46,7 +46,7 @@ func (tp *provider) TestPinAdd(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPinSimple
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPinSimple
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
@@ -96,7 +96,7 @@ func (tp *provider) TestPinSimple(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPinRecursive
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPinRecursive
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
...
...
tests/pubsub.go
View file @
103b6454
...
...
@@ -9,7 +9,7 @@ import (
"github.com/ipfs/interface-go-ipfs-core/options"
)
func
(
tp
*
provider
)
TestPubSub
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestPubSub
(
t
*
testing
.
T
)
{
tp
.
hasApi
(
t
,
func
(
api
iface
.
CoreAPI
)
error
{
if
api
.
PubSub
()
==
nil
{
return
apiNotImplemented
...
...
@@ -20,7 +20,7 @@ func (tp *provider) TestPubSub(t *testing.T) {
t
.
Run
(
"TestBasicPubSub"
,
tp
.
TestBasicPubSub
)
}
func
(
tp
*
provider
)
TestBasicPubSub
(
t
*
testing
.
T
)
{
func
(
tp
*
TestSuite
)
TestBasicPubSub
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
...
...
tests/unixfs.go
View file @
103b6454
...
...
@@ -28,7 +28,7 @@ import (
mh "github.com/multiformats/go-multihash"
)
func
(
tp
*
provider
)
TestUnixfs
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestUnixfs(t *testing.T) {
tp.hasApi(t, func(api coreiface.CoreAPI) error {
if api.Unixfs() == nil {
return apiNotImplemented
...
...
@@ -94,7 +94,7 @@ func wrapped(names ...string) func(f files.Node) files.Node {
}
}
func
(
tp
*
provider
)
TestAdd
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestAdd(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -528,7 +528,7 @@ func (tp *provider) TestAdd(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestAddPinned
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestAddPinned(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -554,7 +554,7 @@ func (tp *provider) TestAddPinned(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestAddHashOnly
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestAddHashOnly(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -580,7 +580,7 @@ func (tp *provider) TestAddHashOnly(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGetEmptyFile
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestGetEmptyFile(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -610,7 +610,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGetDir
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestGetDir(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -643,7 +643,7 @@ func (tp *provider) TestGetDir(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGetNonUnixfs
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestGetNonUnixfs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -663,7 +663,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestLs
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestLs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -723,7 +723,7 @@ func (tp *provider) TestLs(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestEntriesExpired
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestEntriesExpired(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -765,7 +765,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestLsEmptyDir
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestLsEmptyDir(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -794,7 +794,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) {
}
// TODO(lgierth) this should test properly, with len(links) > 0
func
(
tp
*
provider
)
TestLsNonUnixfs
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestLsNonUnixfs(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -853,7 +853,7 @@ func (f *closeTestF) Close() error {
return nil
}
func
(
tp
*
provider
)
TestAddCloses
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestAddCloses(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
@@ -891,7 +891,7 @@ func (tp *provider) TestAddCloses(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestGetSeek
(
t
*
testing
.
T
)
{
func (tp *
TestSuite
) TestGetSeek(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
api, err := tp.makeAPI(ctx)
...
...
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