mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
Merge pull request #235 from ethersphere/improve-tests-swarm-network-rewrite-syncer
swarm: improve tests on swarm-network-rewrite-syncer
This commit is contained in:
commit
5fb5298897
3 changed files with 11 additions and 3 deletions
|
|
@ -33,6 +33,10 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrLinuxOnly = errors.New("DockerAdapter can only be used on Linux as it uses the current binary (which must be a Linux binary)")
|
||||||
|
)
|
||||||
|
|
||||||
// DockerAdapter is a NodeAdapter which runs simulation nodes inside Docker
|
// DockerAdapter is a NodeAdapter which runs simulation nodes inside Docker
|
||||||
// containers.
|
// containers.
|
||||||
//
|
//
|
||||||
|
|
@ -52,7 +56,7 @@ func NewDockerAdapter() (*DockerAdapter, error) {
|
||||||
// It is reasonable to require this because the caller can just
|
// It is reasonable to require this because the caller can just
|
||||||
// compile the current binary in a Docker container.
|
// compile the current binary in a Docker container.
|
||||||
if runtime.GOOS != "linux" {
|
if runtime.GOOS != "linux" {
|
||||||
return nil, errors.New("DockerAdapter can only be used on Linux as it uses the current binary (which must be a Linux binary)")
|
return nil, ErrLinuxOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := buildDockerImage(); err != nil {
|
if err := buildDockerImage(); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test(t *testing.T) {
|
func TestPriorityQueue(t *testing.T) {
|
||||||
var results []string
|
var results []string
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
pq := New(3, 2)
|
pq := New(3, 2)
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,12 @@ func TestDiscoverySimulationDockerAdapter(t *testing.T) {
|
||||||
func testDiscoverySimulationDockerAdapter(t *testing.T, nodes, conns int) {
|
func testDiscoverySimulationDockerAdapter(t *testing.T, nodes, conns int) {
|
||||||
adapter, err := adapters.NewDockerAdapter()
|
adapter, err := adapters.NewDockerAdapter()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == adapters.ErrLinuxOnly {
|
||||||
|
t.Skip(err)
|
||||||
|
} else {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
testDiscoverySimulation(t, nodes, conns, adapter)
|
testDiscoverySimulation(t, nodes, conns, adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue