Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
2b5b0ea9
Commit
2b5b0ea9
authored
Jan 27, 2020
by
Janos Guljas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test exported functionality explicitly in api and debugapi packages
parent
1b8135c0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
11 deletions
+33
-11
api_test.go
pkg/api/api_test.go
+3
-2
export_test.go
pkg/api/export_test.go
+7
-0
pingpong_test.go
pkg/api/pingpong_test.go
+3
-2
debugapi_test.go
pkg/debugapi/debugapi_test.go
+3
-2
export_test.go
pkg/debugapi/export_test.go
+10
-0
peer_test.go
pkg/debugapi/peer_test.go
+3
-2
status_test.go
pkg/debugapi/status_test.go
+4
-3
No files found.
pkg/api/api_test.go
View file @
2b5b0ea9
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
api
package
api
_test
import
(
"io/ioutil"
...
...
@@ -11,6 +11,7 @@ import (
"net/url"
"testing"
"github.com/ethersphere/bee/pkg/api"
"github.com/ethersphere/bee/pkg/logging"
"github.com/ethersphere/bee/pkg/pingpong"
"resenje.org/web"
...
...
@@ -21,7 +22,7 @@ type testServerOptions struct {
}
func
newTestServer
(
t
*
testing
.
T
,
o
testServerOptions
)
(
client
*
http
.
Client
,
cleanup
func
())
{
s
:=
New
(
Options
{
s
:=
api
.
New
(
api
.
Options
{
Pingpong
:
o
.
Pingpong
,
Logger
:
logging
.
New
(
ioutil
.
Discard
),
})
...
...
pkg/api/export_test.go
0 → 100644
View file @
2b5b0ea9
// Copyright 2020 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
api
type
PingpongResponse
=
pingpongResponse
pkg/api/pingpong_test.go
View file @
2b5b0ea9
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
api
package
api
_test
import
(
"context"
...
...
@@ -11,6 +11,7 @@ import (
"testing"
"time"
"github.com/ethersphere/bee/pkg/api"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/jsonhttp/jsonhttptest"
"github.com/ethersphere/bee/pkg/p2p"
...
...
@@ -40,7 +41,7 @@ func TestPingpong(t *testing.T) {
defer
cleanup
()
t
.
Run
(
"ok"
,
func
(
t
*
testing
.
T
)
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodPost
,
"/pingpong/"
+
peerID
,
nil
,
http
.
StatusOK
,
p
ingpongResponse
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodPost
,
"/pingpong/"
+
peerID
,
nil
,
http
.
StatusOK
,
api
.
P
ingpongResponse
{
RTT
:
rtt
,
})
})
...
...
pkg/debugapi/debugapi_test.go
View file @
2b5b0ea9
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
debugapi
package
debugapi
_test
import
(
"io/ioutil"
...
...
@@ -11,6 +11,7 @@ import (
"net/url"
"testing"
"github.com/ethersphere/bee/pkg/debugapi"
"github.com/ethersphere/bee/pkg/logging"
"github.com/ethersphere/bee/pkg/p2p"
"resenje.org/web"
...
...
@@ -21,7 +22,7 @@ type testServerOptions struct {
}
func
newTestServer
(
t
*
testing
.
T
,
o
testServerOptions
)
(
client
*
http
.
Client
,
cleanup
func
())
{
s
:=
New
(
Options
{
s
:=
debugapi
.
New
(
debugapi
.
Options
{
P2P
:
o
.
P2P
,
Logger
:
logging
.
New
(
ioutil
.
Discard
),
})
...
...
pkg/debugapi/export_test.go
0 → 100644
View file @
2b5b0ea9
// Copyright 2020 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
debugapi
type
(
StatusResponse
=
statusResponse
PeerConnectResponse
=
peerConnectResponse
)
pkg/debugapi/peer_test.go
View file @
2b5b0ea9
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
debugapi
package
debugapi
_test
import
(
"context"
...
...
@@ -10,6 +10,7 @@ import (
"net/http"
"testing"
"github.com/ethersphere/bee/pkg/debugapi"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/jsonhttp/jsonhttptest"
"github.com/ethersphere/bee/pkg/p2p/mock"
...
...
@@ -33,7 +34,7 @@ func TestConnect(t *testing.T) {
defer
cleanup
()
t
.
Run
(
"ok"
,
func
(
t
*
testing
.
T
)
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodPost
,
"/connect"
+
underlay
,
nil
,
http
.
StatusOK
,
p
eerConnectResponse
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodPost
,
"/connect"
+
underlay
,
nil
,
http
.
StatusOK
,
debugapi
.
P
eerConnectResponse
{
Address
:
overlay
,
})
})
...
...
pkg/debugapi/status_test.go
View file @
2b5b0ea9
...
...
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
debugapi
package
debugapi
_test
import
(
"net/http"
"testing"
"github.com/ethersphere/bee/pkg/debugapi"
"github.com/ethersphere/bee/pkg/jsonhttp/jsonhttptest"
)
...
...
@@ -15,7 +16,7 @@ func TestHealth(t *testing.T) {
client
,
cleanup
:=
newTestServer
(
t
,
testServerOptions
{})
defer
cleanup
()
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodGet
,
"/health"
,
nil
,
http
.
StatusOK
,
s
tatusResponse
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodGet
,
"/health"
,
nil
,
http
.
StatusOK
,
debugapi
.
S
tatusResponse
{
Status
:
"ok"
,
})
}
...
...
@@ -24,7 +25,7 @@ func TestReadiness(t *testing.T) {
client
,
cleanup
:=
newTestServer
(
t
,
testServerOptions
{})
defer
cleanup
()
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodGet
,
"/readiness"
,
nil
,
http
.
StatusOK
,
s
tatusResponse
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodGet
,
"/readiness"
,
nil
,
http
.
StatusOK
,
debugapi
.
S
tatusResponse
{
Status
:
"ok"
,
})
}
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