mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
cmd/swarm: use same cluster across ACT and SwarmUp tests
This commit is contained in:
parent
3722447fae
commit
eb0c5cf630
3 changed files with 19 additions and 14 deletions
|
|
@ -28,7 +28,9 @@ import (
|
||||||
gorand "math/rand"
|
gorand "math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -48,11 +50,24 @@ const (
|
||||||
|
|
||||||
var DefaultCurve = crypto.S256()
|
var DefaultCurve = crypto.S256()
|
||||||
|
|
||||||
var cluster *testCluster
|
|
||||||
|
|
||||||
const clusterSize = 3
|
const clusterSize = 3
|
||||||
|
|
||||||
|
var clusteronce sync.Once
|
||||||
|
var cluster *testCluster
|
||||||
|
|
||||||
|
func initCluster(t *testing.T) {
|
||||||
|
clusteronce.Do(func() {
|
||||||
|
cluster = newTestCluster(t, clusterSize)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestACT(t *testing.T) {
|
func TestACT(t *testing.T) {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
|
|
||||||
|
initCluster(t)
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
f func(t *testing.T)
|
f func(t *testing.T)
|
||||||
|
|
@ -63,9 +78,6 @@ func TestACT(t *testing.T) {
|
||||||
{"ACTWithBogus", testACTWithBogus},
|
{"ACTWithBogus", testACTWithBogus},
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster = newTestCluster(t, clusterSize)
|
|
||||||
defer cluster.Shutdown()
|
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
t.Run(tc.name, tc.f)
|
t.Run(tc.name, tc.f)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
colorable "github.com/mattn/go-colorable"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
log.PrintOrigins(true)
|
|
||||||
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*loglevel), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true))))
|
|
||||||
}
|
|
||||||
|
|
||||||
type testFile struct {
|
type testFile struct {
|
||||||
filePath string
|
filePath string
|
||||||
content string
|
content string
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ func TestSwarmUp(t *testing.T) {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initCluster(t)
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
f func(t *testing.T)
|
f func(t *testing.T)
|
||||||
|
|
@ -57,9 +59,6 @@ func TestSwarmUp(t *testing.T) {
|
||||||
{"DefaultPathAll", testDefaultPathAll},
|
{"DefaultPathAll", testDefaultPathAll},
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster = newTestCluster(t, clusterSize)
|
|
||||||
defer cluster.Shutdown()
|
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
t.Run(tc.name, tc.f)
|
t.Run(tc.name, tc.f)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue