Svarog a7299c1b87
Add stability tests (#1587)
* Add stability-tests

* Fix requires

* Fix golint errors

* Update README.md

* Remove payloadHash from everywhere

* don't run vet on kaspad in stability-tests/install_and_test
2021-03-09 15:01:08 +02:00

45 lines
1.2 KiB
Go

package main
import (
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient/grpcclient"
"github.com/kaspanet/kaspad/stability-tests/common"
"github.com/kaspanet/kaspad/util/panics"
"github.com/kaspanet/kaspad/util/profiling"
"github.com/pkg/errors"
)
func main() {
defer panics.HandlePanic(log, "rpc-stability-main", nil)
err := parseConfig()
if err != nil {
panic(errors.Wrap(err, "error parsing configuration"))
}
defer backendLog.Close()
common.UseLogger(backendLog, log.Level())
cfg := activeConfig()
if cfg.Profile != "" {
profiling.Start(cfg.Profile, log)
}
rpcAddress, err := cfg.NetParams().NormalizeRPCServerAddress(cfg.RPCServer)
if err != nil {
panic(errors.Wrap(err, "error parsing RPC server address"))
}
rpcClient, err := grpcclient.Connect(rpcAddress)
if err != nil {
panic(errors.Wrap(err, "error connecting to RPC server"))
}
defer rpcClient.Disconnect()
commandsChan, err := readCommands()
if err != nil {
panic(errors.Wrapf(err, "error reading commands from file %s", cfg.CommandsFilePath))
}
err = sendCommands(rpcClient, commandsChan)
if err != nil {
panic(errors.Wrap(err, "error sending commands"))
}
}