* Start system tests * Go mod tidy * Add system tests (#1411) * Add tests * Add test-system to CI * Fix path * Remove store artifact steps * Add small fixes * Add stake/unstake tests * Add unsafe-reset-all extention + system test * Replace ustake with stake * Add more tests + fix bug in cli * Fix comments and add multi contract system test * Updates and fixes to system tests (#1449) * Updates * Minor cleanup * Make tests pass --------- Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> * Fix Makefile to return exit code for system tests (#1450) * Abort on error results --------- Co-authored-by: pinosu <95283998+pinosu@users.noreply.github.com>
33 lines
841 B
Go
33 lines
841 B
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
client "github.com/cometbft/cometbft/rpc/client/http"
|
|
cmtypes "github.com/cometbft/cometbft/types"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// RPCClient is a test helper to interact with a node via the RPC endpoint.
|
|
type RPCClient struct {
|
|
client *client.HTTP
|
|
t *testing.T
|
|
}
|
|
|
|
// NewRPCClient constructor
|
|
func NewRPCClient(t *testing.T, addr string) RPCClient {
|
|
httpClient, err := client.New(addr, "/websocket")
|
|
require.NoError(t, err)
|
|
require.NoError(t, httpClient.Start())
|
|
t.Cleanup(func() { _ = httpClient.Stop() })
|
|
return RPCClient{client: httpClient, t: t}
|
|
}
|
|
|
|
// Validators returns list of validators
|
|
func (r RPCClient) Validators() []*cmtypes.Validator {
|
|
v, err := r.client.Validators(context.Background(), nil, nil, nil)
|
|
require.NoError(r.t, err)
|
|
return v.Validators
|
|
}
|