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
1a3392a5
Commit
1a3392a5
authored
Jan 17, 2019
by
Steven Allen
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5926 from ipfs/fix/coreapi-test-checks
coreapi: Adjust some tests for go-ipfs-http-api
parents
6c323ff1
fb15570c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
13 deletions
+29
-13
tests/block.go
tests/block.go
+2
-2
tests/dht.go
tests/dht.go
+18
-2
tests/key.go
tests/key.go
+8
-8
tests/object.go
tests/object.go
+1
-1
No files found.
tests/block.go
View file @
1a3392a5
...
...
@@ -159,7 +159,7 @@ func (tp *provider) TestBlockRm(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected err to exist"
)
}
if
err
.
Error
()
!=
"blockservice: key not found"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"blockservice: key not found"
)
{
t
.
Errorf
(
"unexpected error; %s"
,
err
.
Error
())
}
...
...
@@ -167,7 +167,7 @@ func (tp *provider) TestBlockRm(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected err to exist"
)
}
if
err
.
Error
()
!=
"blockstore: block not found"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"blockstore: block not found"
)
{
t
.
Errorf
(
"unexpected error; %s"
,
err
.
Error
())
}
...
...
tests/dht.go
View file @
1a3392a5
...
...
@@ -35,12 +35,20 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) {
t
.
Fatal
(
err
)
}
laddrs0
,
err
:=
apis
[
0
]
.
Swarm
()
.
LocalAddrs
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
len
(
laddrs0
)
!=
1
{
t
.
Fatal
(
"unexpected number of local addrs"
)
}
pi
,
err
:=
apis
[
2
]
.
Dht
()
.
FindPeer
(
ctx
,
self0
.
ID
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
pi
.
Addrs
[
0
]
.
String
()
!=
"/ip4/127.0.0.1/tcp/4001"
{
if
pi
.
Addrs
[
0
]
.
String
()
!=
laddrs0
[
0
]
.
String
()
{
t
.
Errorf
(
"got unexpected address from FindPeer: %s"
,
pi
.
Addrs
[
0
]
.
String
())
}
...
...
@@ -54,7 +62,15 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) {
t
.
Fatal
(
err
)
}
if
pi
.
Addrs
[
0
]
.
String
()
!=
"/ip4/127.0.2.1/tcp/4001"
{
laddrs2
,
err
:=
apis
[
2
]
.
Swarm
()
.
LocalAddrs
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
len
(
laddrs2
)
!=
1
{
t
.
Fatal
(
"unexpected number of local addrs"
)
}
if
pi
.
Addrs
[
0
]
.
String
()
!=
laddrs2
[
0
]
.
String
()
{
t
.
Errorf
(
"got unexpected address from FindPeer: %s"
,
pi
.
Addrs
[
0
]
.
String
())
}
}
...
...
tests/key.go
View file @
1a3392a5
...
...
@@ -82,7 +82,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot rename key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot rename key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot rename key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -91,7 +91,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot rename key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot rename key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot rename key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -110,7 +110,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot remove key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot remove key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot remove key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -206,7 +206,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"key with name 'foo' already exists"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"key with name 'foo' already exists"
)
{
t
.
Fatalf
(
"expected error 'key with name 'foo' already exists', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -215,7 +215,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot create key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot create key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot create key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -314,7 +314,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot overwrite key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot overwrite key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot overwrite key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -338,7 +338,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"cannot overwrite key with name 'self'"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"cannot overwrite key with name 'self'"
)
{
t
.
Fatalf
(
"expected error 'cannot overwrite key with name 'self'', got '%s'"
,
err
.
Error
())
}
}
...
...
@@ -368,7 +368,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) {
if
err
==
nil
{
t
.
Error
(
"expected error to not be nil"
)
}
else
{
if
err
.
Error
()
!=
"key by that name already exists, refusing to overwrite"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"key by that name already exists, refusing to overwrite"
)
{
t
.
Fatalf
(
"expected error 'key by that name already exists, refusing to overwrite', got '%s'"
,
err
.
Error
())
}
}
...
...
tests/object.go
View file @
1a3392a5
...
...
@@ -300,7 +300,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) {
if
err
==
nil
{
t
.
Fatal
(
"expected an error"
)
}
if
err
.
Error
()
!=
"no link by that name"
{
if
!
strings
.
Contains
(
err
.
Error
()
,
"no link by that name"
)
{
t
.
Fatalf
(
"unexpected error: %s"
,
err
.
Error
())
}
...
...
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