aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/protocols/accounting_simulation_test.go
diff options
context:
space:
mode:
authorholisticode <holistic.computing@gmail.com>2018-11-27 00:05:18 +0800
committerAnton Evangelatov <anton.evangelatov@gmail.com>2018-11-27 00:05:18 +0800
commitbba5fd81921ee700388b4db72db3240d32576b6c (patch)
tree7bb72f95c00feecc448f27a650b08da59a77cbf3 /p2p/protocols/accounting_simulation_test.go
parent2714e8f091117b4f110198008348bfc19233ed60 (diff)
downloadgo-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar.gz
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar.bz2
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar.lz
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar.xz
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.tar.zst
go-tangerine-bba5fd81921ee700388b4db72db3240d32576b6c.zip
Accounting metrics reporter (#18136)
Diffstat (limited to 'p2p/protocols/accounting_simulation_test.go')
-rw-r--r--p2p/protocols/accounting_simulation_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/p2p/protocols/accounting_simulation_test.go b/p2p/protocols/accounting_simulation_test.go
index 65b737abe..e90a1d81d 100644
--- a/p2p/protocols/accounting_simulation_test.go
+++ b/p2p/protocols/accounting_simulation_test.go
@@ -20,7 +20,10 @@ import (
"context"
"flag"
"fmt"
+ "io/ioutil"
"math/rand"
+ "os"
+ "path/filepath"
"reflect"
"sync"
"testing"
@@ -66,6 +69,13 @@ func init() {
func TestAccountingSimulation(t *testing.T) {
//setup the balances objects for every node
bal := newBalances(*nodes)
+ //setup the metrics system or tests will fail trying to write metrics
+ dir, err := ioutil.TempDir("", "account-sim")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(dir)
+ SetupAccountingMetrics(1*time.Second, filepath.Join(dir, "metrics.db"))
//define the node.Service for this test
services := adapters.Services{
"accounting": func(ctx *adapters.ServiceContext) (node.Service, error) {