integration

package
v0.0.0-...-ddfbed8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StandaloneNetworkPassphrase = "Standalone Network ; February 2017"
	EthereumBridgeAddress       = "0x31995201773dA53F950f15278Ea1538eA37A68A1"
	EthereumXLMTokenAddress     = "0x4Ee50847CD1278DBE87190080DD53055672755F6"
	EthereumRPCURL              = "http://127.0.0.1:8545"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Servers                int
	EthereumFinalityBuffer uint64
	WithdrawalWindow       time.Duration
}

type Test

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

func NewIntegrationTest

func NewIntegrationTest(t *testing.T, config Config) *Test

NewIntegrationTest starts a new environment for integration test.

WARNING: This requires Docker Compose installed.

func (*Test) Client

func (i *Test) Client() *http.Client

Client returns http.Client connected to started Starbridge instance.

func (*Test) CreateAccounts

func (i *Test) CreateAccounts(count int) ([]*keypair.Full, []txnbuild.Account)

Creates new accounts via friendbot.

Returns: The slice of created keypairs and account objects.

Note: panics on any errors, since we assume that tests cannot proceed without this method succeeding.

func (*Test) CreateSignedTransaction

func (i *Test) CreateSignedTransaction(signers []*keypair.Full, txParams txnbuild.TransactionParams,
) (*txnbuild.Transaction, error)

func (*Test) CreateSignedTransactionFromOps

func (i *Test) CreateSignedTransactionFromOps(
	source txnbuild.Account, signers []*keypair.Full, ops ...txnbuild.Operation,
) (*txnbuild.Transaction, error)

func (*Test) CurrentTest

func (i *Test) CurrentTest() *testing.T

func (*Test) HorizonClient

func (i *Test) HorizonClient() *horizonclient.Client

HorizonClient returns horizon.Client connected to started Horizon instance.

func (*Test) LogFailedTx

func (i *Test) LogFailedTx(txResponse proto.Transaction, horizonResult error)

LogFailedTx is a convenience function to provide verbose information about a failing transaction to the test output log, if it's expected to succeed.

func (*Test) Master

func (i *Test) Master() *keypair.Full

Master returns a keypair of the network masterKey account.

func (*Test) MasterAccount

func (i *Test) MasterAccount() txnbuild.Account

func (*Test) MasterAccountDetails

func (i *Test) MasterAccountDetails() proto.Account

func (*Test) MustGetAccount

func (i *Test) MustGetAccount(source *keypair.Full) proto.Account

MustGetAccount panics on any error retrieves an account's details from its key. This means it must have previously been funded.

func (*Test) MustSubmitMultiSigOperations

func (i *Test) MustSubmitMultiSigOperations(
	source txnbuild.Account, signers []*keypair.Full, ops ...txnbuild.Operation,
) proto.Transaction

func (*Test) MustSubmitMultiSigTransaction

func (i *Test) MustSubmitMultiSigTransaction(
	signers []*keypair.Full, txParams txnbuild.TransactionParams,
) proto.Transaction

func (*Test) MustSubmitOperations

func (i *Test) MustSubmitOperations(
	source txnbuild.Account, signer *keypair.Full, ops ...txnbuild.Operation,
) proto.Transaction

MustSubmitOperations submits a signed transaction from an account with standard options.

Namely, we set the standard fee, time bounds, etc. to "non-production" defaults that work well for tests.

Most transactions only need one signer, so see the more verbose `MustSubmitOperationsWithSigners` below for multi-sig transactions.

Note: We assume that transaction will be successful here so we panic in case of all errors. To allow failures, use `SubmitOperations`.

func (*Test) MustSubmitTransaction

func (i *Test) MustSubmitTransaction(signer *keypair.Full, txParams txnbuild.TransactionParams,
) proto.Transaction

func (*Test) Shutdown

func (i *Test) Shutdown()

Shutdown stops the integration tests and destroys all its associated resources. It will be implicitly called when the calling test (i.e. the `testing.Test` passed to `New()`) is finished if it hasn't been explicitly called before.

func (*Test) StartStarbridge

func (i *Test) StartStarbridge(id int, config Config, ingestSequence uint32) error

func (*Test) StopStarbridge

func (i *Test) StopStarbridge()

StopStarbridge shuts down the running starbridge processes

func (*Test) SubmitMultiSigOperations

func (i *Test) SubmitMultiSigOperations(
	source txnbuild.Account, signers []*keypair.Full, ops ...txnbuild.Operation,
) (proto.Transaction, error)

func (*Test) SubmitMultiSigTransaction

func (i *Test) SubmitMultiSigTransaction(
	signers []*keypair.Full, txParams txnbuild.TransactionParams,
) (proto.Transaction, error)

func (*Test) SubmitOperations

func (i *Test) SubmitOperations(
	source txnbuild.Account, signer *keypair.Full, ops ...txnbuild.Operation,
) (proto.Transaction, error)

func (*Test) SubmitTransaction

func (i *Test) SubmitTransaction(
	signer *keypair.Full, txParams txnbuild.TransactionParams,
) (proto.Transaction, error)

Jump to

Keyboard shortcuts

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