mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* 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
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/kaspanet/kaspad/stability-tests/common"
|
|
"github.com/kaspanet/kaspad/stability-tests/common/rpc"
|
|
"github.com/kaspanet/kaspad/util/panics"
|
|
"github.com/kaspanet/kaspad/util/profiling"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func main() {
|
|
defer panics.HandlePanic(log, "rpc-idle-clients-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)
|
|
}
|
|
|
|
numRPCClients := cfg.NumClients
|
|
clients := make([]*rpc.Client, numRPCClients)
|
|
for i := uint32(0); i < numRPCClients; i++ {
|
|
rpcClient, err := rpc.ConnectToRPC(&cfg.Config, cfg.NetParams())
|
|
if err != nil {
|
|
panic(errors.Wrap(err, "error connecting to RPC server"))
|
|
}
|
|
clients[i] = rpcClient
|
|
}
|
|
|
|
const testDuration = 30 * time.Second
|
|
select {
|
|
case <-time.After(testDuration):
|
|
}
|
|
for _, client := range clients {
|
|
client.Close()
|
|
}
|
|
}
|