internal

package
v0.32.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoError                    int = iota // 0
	ErrInvalidParameters                  // 1
	ErrMaxAcceptRetriesReached            // 2
	ErrFailedToLoadGenesisFile            // 3
	ErrFailedToCreateListener             // 4
	ErrFailedToStartListener              // 5
	ErrInterrupted                        // 6
	ErrOther                              // 7
	ErrTestPublicKeyFailed                // 8
	ErrTestSignProposalFailed             // 9
	ErrTestSignVoteFailed                 // 10
)

Test harness error codes (which act as exit codes when the test harness fails).

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) string

ExpandPath will check if the given path begins with a "~" symbol, and if so, will expand it to become the user's home directory. If it fails to expand the path it will automatically return the original path itself.

Types

type TestHarness

type TestHarness struct {
	// contains filtered or unexported fields
}

TestHarness allows for testing of a remote signer to ensure compatibility with this version of Tendermint.

func NewTestHarness

func NewTestHarness(logger log.Logger, cfg TestHarnessConfig) (*TestHarness, error)

NewTestHarness will load Tendermint data from the given files (including validator public/private keypairs and chain details) and create a new harness.

func (*TestHarness) Run

func (th *TestHarness) Run()

Run will execute the tests associated with this test harness. The intention here is to call this from one's `main` function, as the way it succeeds or fails at present is to call os.Exit() with an exit code related to the error that caused the tests to fail, or exit code 0 on success.

func (*TestHarness) Shutdown

func (th *TestHarness) Shutdown(err error)

Shutdown will kill the test harness and attempt to close all open sockets gracefully. If the supplied error is nil, it is assumed that the exit code should be 0. If err is not nil, it will exit with an exit code related to the error.

func (*TestHarness) TestPublicKey

func (th *TestHarness) TestPublicKey() error

TestPublicKey just validates that we can (1) fetch the public key from the remote signer, and (2) it matches the public key we've configured for our local Tendermint version.

func (*TestHarness) TestSignProposal

func (th *TestHarness) TestSignProposal() error

TestSignProposal makes sure the remote signer can successfully sign proposals.

func (*TestHarness) TestSignVote

func (th *TestHarness) TestSignVote() error

TestSignVote makes sure the remote signer can successfully sign all kinds of votes.

type TestHarnessConfig

type TestHarnessConfig struct {
	BindAddr string

	KeyFile     string
	StateFile   string
	GenesisFile string

	AcceptDeadline time.Duration
	ConnDeadline   time.Duration
	AcceptRetries  int

	SecretConnKey ed25519.PrivKeyEd25519

	ExitWhenComplete bool // Whether or not to call os.Exit when the harness has completed.
}

TestHarnessConfig provides configuration to set up a remote signer test harness.

type TestHarnessError

type TestHarnessError struct {
	Code int    // The exit code to return
	Err  error  // The original error
	Info string // Any additional information
}

TestHarnessError allows us to keep track of which exit code should be used when exiting the main program.

func (*TestHarnessError) Error

func (e *TestHarnessError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL