Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions swarm/pss/pss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/influxdb"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
Expand Down Expand Up @@ -951,7 +953,7 @@ func worker(id int, jobs <-chan Job, rpcs map[discover.NodeID]*rpc.Client, pubke
// nodes/msgs/addrbytes/adaptertype
// if adaptertype is exec uses execadapter, simadapter otherwise
func TestNetwork2000(t *testing.T) {
//testutil.EnableMetrics()
//enableMetrics()

t.Run("3/2000/4/sock", testNetwork)
t.Run("4/2000/4/sock", testNetwork)
Expand All @@ -960,7 +962,7 @@ func TestNetwork2000(t *testing.T) {
}

func TestNetwork5000(t *testing.T) {
//testutil.EnableMetrics()
//enableMetrics()

t.Run("3/5000/4/sim", testNetwork)
t.Run("4/5000/4/sim", testNetwork)
Expand All @@ -969,12 +971,11 @@ func TestNetwork5000(t *testing.T) {
}

func TestNetwork10000(t *testing.T) {
//testutil.EnableMetrics()
//enableMetrics()

t.Run("3/10000/4/sim", testNetwork)
t.Run("4/10000/4/sim", testNetwork)
t.Run("8/10000/4/sim", testNetwork)
t.Run("16/10000/4/sim", testNetwork)
}

func testNetwork(t *testing.T) {
Expand Down Expand Up @@ -1674,3 +1675,11 @@ func (apitest *APITest) SetSymKeys(pubkeyid string, recvsymkey []byte, sendsymke
func (apitest *APITest) Clean() (int, error) {
return apitest.Pss.cleanKeys(), nil
}

// enableMetrics is starting InfluxDB reporter so that we collect stats when running tests locally
func enableMetrics() {
metrics.Enabled = true
go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 1*time.Second, "http://localhost:8086", "metrics", "admin", "admin", "swarm.", map[string]string{
"host": "test",
})
}
11 changes: 0 additions & 11 deletions swarm/testutil/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ import (
"net/http/httptest"
"os"
"testing"
"time"

"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/influxdb"
"github.com/ethereum/go-ethereum/swarm/api"
"github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/swarm/storage/mru"
Expand Down Expand Up @@ -109,11 +106,3 @@ type TestSwarmServer struct {
func (t *TestSwarmServer) Close() {
t.cleanup()
}

// EnableMetrics is starting InfluxDB reporter so that we collect stats when running tests locally
func EnableMetrics() {
metrics.Enabled = true
go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 1*time.Second, "http://localhost:8086", "metrics", "admin", "admin", "swarm.", map[string]string{
"host": "test",
})
}