Accounting metrics reporter (#18136)

This commit is contained in:
holisticode
2018-11-26 11:05:18 -05:00
committed by Anton Evangelatov
parent 2714e8f091
commit bba5fd8192
6 changed files with 305 additions and 30 deletions

View File

@ -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) {