testutil

package
v0.0.129 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 41 Imported by: 0

Documentation

Overview

Package testutil contains mock deployers for interacting with the mock backend

Index

Constants

View Source
const (
	// OriginType is the type of the origin.
	OriginType contractTypeImpl = iota // Origin
	// MessageHarnessType is the type of the message harness contract.
	MessageHarnessType // MessageHarness
	// OriginHarnessType is the origin harness type.
	OriginHarnessType // OriginHarness
	// AttestationHarnessType is the attestation harness type.
	AttestationHarnessType
	// TipsHarnessType is the type of the tips harness.
	TipsHarnessType
	// HeaderHarnessType is the type of the header harness.
	HeaderHarnessType
	// DestinationHarnessType is the destination harness type.
	DestinationHarnessType // DestinationHarness
	// AttestationCollectorType is the type of the attestation collector.
	AttestationCollectorType // AttestationCollector
	// DestinationType is the type of the destination.
	DestinationType // Destination
	// AgentsTestContractType is the type of the agents test contract.
	AgentsTestContractType // AgentsTestContract
	// TestClientType is the type of the test client.
	TestClientType // TestClient
	// PingPongClientType is the type of the test client.
	PingPongClientType // PingPongClient
)

Variables

View Source
var AllContractTypes []contractTypeImpl

AllContractTypes is a list of all contract types. Since we use stringer and this is a testing library, instead of manually copying all these out we pull the names out of stringer. In order to make sure stringer is updated, we panic on any method called where the index is higher than the stringer array length.

Functions

func NewAgentsTestContractDeployer added in v0.0.65

func NewAgentsTestContractDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewAgentsTestContractDeployer gets the agents test contract.

func NewAttestationCollectorDeployer

func NewAttestationCollectorDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewAttestationCollectorDeployer creates the deployer for the attestation collecotr.

func NewAttestationHarnessDeployer

func NewAttestationHarnessDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewAttestationHarnessDeployer creates a new deployer for the attestation harness.

func NewDestinationDeployer

NewDestinationDeployer creates the deployer for the destination.

func NewDestinationHarnessDeployer

func NewDestinationHarnessDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewDestinationHarnessDeployer creates a new deployer for the destination harness.

func NewHeaderHarnessDeployer

func NewHeaderHarnessDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewHeaderHarnessDeployer gets the header harness.

func NewMessageHarnessDeployer

func NewMessageHarnessDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewMessageHarnessDeployer creates a message harness deployer.

func NewOriginDeployer

NewOriginDeployer deploys the origin contract.

func NewOriginHarnessDeployer

func NewOriginHarnessDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewOriginHarnessDeployer deploys a new origin harness.

func NewPingPongClientDeployer added in v0.0.110

func NewPingPongClientDeployer(registry deployer.GetOnlyContractRegistry, backend backends.SimulatedTestBackend) deployer.ContractDeployer

NewPingPongClientDeployer gets the ping pong test client.

func NewTestClientDeployer added in v0.0.104

NewTestClientDeployer gets the test client.

func NewTipsHarnessDeployer

NewTipsHarnessDeployer creates a new deployer for the attestation harness.

Types

type AgentsTestContractDeployer added in v0.0.65

type AgentsTestContractDeployer struct {
	*deployer.BaseDeployer
}

AgentsTestContractDeployer deploys the agents test contract.

func (AgentsTestContractDeployer) Deploy added in v0.0.65

Deploy deploys the agents test contract.

type AttestationCollectorDeployer

type AttestationCollectorDeployer struct {
	*deployer.BaseDeployer
}

AttestationCollectorDeployer deploys the attestation collector.

func (AttestationCollectorDeployer) Deploy

Deploy deploys the attestation collector.

type AttestationHarnessDeployer

type AttestationHarnessDeployer struct {
	*deployer.BaseDeployer
}

AttestationHarnessDeployer deploys the attestation harness.

func (AttestationHarnessDeployer) Deploy

Deploy deploys the attestation harness.

type DeployManager

type DeployManager struct {
	*manager.DeployerManager
}

DeployManager wraps DeployManager and allows typed contract handles to be returned.

func NewDeployManager

func NewDeployManager(t *testing.T) *DeployManager

NewDeployManager creates a deploy manager.

func (*DeployManager) GetAgentsTestContract added in v0.0.65

GetAgentsTestContract gets the agents test contract.

func (*DeployManager) GetAttestationCollector

GetAttestationCollector gets the attestation collector contract.

func (*DeployManager) GetAttestationHarness

GetAttestationHarness gets the attestation harness.

func (*DeployManager) GetDestination

GetDestination gets the destination contract.

func (*DeployManager) GetDestinationHarness

GetDestinationHarness gets the destination harness.

func (*DeployManager) GetHeaderHarness

GetHeaderHarness gets the header harness.

func (*DeployManager) GetMessageHarness

GetMessageHarness gets the message harness.

func (*DeployManager) GetOrigin

func (d *DeployManager) GetOrigin(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *origin.OriginRef)

GetOrigin gets a typecast origin contract.

func (*DeployManager) GetOriginHarness

GetOriginHarness gets the origin harness.

func (*DeployManager) GetPingPongClient added in v0.0.110

GetPingPongClient gets the ping pong test client.

func (*DeployManager) GetTestClient added in v0.0.104

GetTestClient gets the test client.

func (*DeployManager) GetTipsHarness

GetTipsHarness gets the tips harness for testing.

type DestinationDeployer

type DestinationDeployer struct {
	*deployer.BaseDeployer
}

DestinationDeployer deploys the destination.

func (DestinationDeployer) Dependencies

func (d DestinationDeployer) Dependencies() []contracts.ContractType

Dependencies gets a list of dependencies used to deploy the destination contract.

func (DestinationDeployer) Deploy

Deploy deploys the destination.

type DestinationHarnessDeployer

type DestinationHarnessDeployer struct {
	*deployer.BaseDeployer
}

DestinationHarnessDeployer deploys the destination harness.

func (DestinationHarnessDeployer) Deploy

Deploy deploys the destination harness. nolint:dupl

type HeaderHarnessDeployer

type HeaderHarnessDeployer struct {
	*deployer.BaseDeployer
}

HeaderHarnessDeployer deploys the header harness.

func (HeaderHarnessDeployer) Deploy

Deploy deploys the header harness.

type MessageHarnessDeployer

type MessageHarnessDeployer struct {
	*deployer.BaseDeployer
}

MessageHarnessDeployer deploys the message harness for testing.

func (MessageHarnessDeployer) Deploy

Deploy deploys the message harness deployer.

type OriginDeployer

type OriginDeployer struct {
	*deployer.BaseDeployer
}

OriginDeployer deploys the origin contract.

func (OriginDeployer) Dependencies

func (d OriginDeployer) Dependencies() []contracts.ContractType

Dependencies gets a list of dependencies used to deploy the origin contract.

func (OriginDeployer) Deploy

Deploy deploys the origin contract.

type OriginHarnessDeployer

type OriginHarnessDeployer struct {
	*deployer.BaseDeployer
}

OriginHarnessDeployer deploys the origin harness for testing.

func (OriginHarnessDeployer) Dependencies added in v0.0.20

func (o OriginHarnessDeployer) Dependencies() []contracts.ContractType

Dependencies gets a list of dependencies used to deploy the origin contract.

func (OriginHarnessDeployer) Deploy

Deploy deploys the origin harness. nolint:dupl

type PingPongClientDeployer added in v0.0.110

type PingPongClientDeployer struct {
	*deployer.BaseDeployer
}

PingPongClientDeployer deploys the ping pong test client.

func (PingPongClientDeployer) Deploy added in v0.0.110

Deploy deploys the ping pong test client.

type SimulatedBackendsTestSuite added in v0.0.54

type SimulatedBackendsTestSuite struct {
	*testsuite.TestSuite
	OriginContract                      *originharness.OriginHarnessRef
	OriginContractMetadata              contracts.DeployedContract
	DestinationContractOnOrigin         *destinationharness.DestinationHarnessRef
	DestinationContractMetadataOnOrigin contracts.DeployedContract
	TestClientOnOrigin                  *testclient.TestClientRef
	TestClientMetadataOnOrigin          contracts.DeployedContract
	PingPongClientOnOrigin              *pingpongclient.PingPongClientRef
	PingPongClientMetadataOnOrigin      contracts.DeployedContract
	DestinationContract                 *destinationharness.DestinationHarnessRef
	DestinationContractMetadata         contracts.DeployedContract
	OriginContractOnDestination         *originharness.OriginHarnessRef
	OriginContractMetadataOnDestination contracts.DeployedContract
	TestClientOnDestination             *testclient.TestClientRef
	TestClientMetadataOnDestination     contracts.DeployedContract
	PingPongClientOnDestination         *pingpongclient.PingPongClientRef
	PingPongClientMetadataOnDestination contracts.DeployedContract
	AttestationHarness                  *attestationharness.AttestationHarnessRef
	AttestationContract                 *attestationcollector.AttestationCollectorRef
	AttestationContractMetadata         contracts.DeployedContract
	TestBackendOrigin                   backends.SimulatedTestBackend
	TestBackendDestination              backends.SimulatedTestBackend
	TestBackendAttestation              backends.SimulatedTestBackend
	NotaryBondedWallet                  wallet.Wallet
	NotaryOnOriginBondedWallet          wallet.Wallet
	GuardBondedWallet                   wallet.Wallet
	NotaryBondedSigner                  signer.Signer
	NotaryOnOriginBondedSigner          signer.Signer
	GuardBondedSigner                   signer.Signer
	NotaryUnbondedWallet                wallet.Wallet
	NotaryUnbondedSigner                signer.Signer
	NotaryOnOriginUnbondedWallet        wallet.Wallet
	NotaryOnOriginUnbondedSigner        signer.Signer
	GuardUnbondedWallet                 wallet.Wallet
	GuardUnbondedSigner                 signer.Signer
	ExecutorUnbondedWallet              wallet.Wallet
	ExecutorUnbondedSigner              signer.Signer
	OriginDomainClient                  domains.DomainClient
	AttestationDomainClient             domains.DomainClient
	DestinationDomainClient             domains.DomainClient
	TestDeployManager                   *DeployManager
	ScribeTestDB                        scribedb.EventDB
	DBPath                              string
	ExecutorTestDB                      db.ExecutorDB
}

SimulatedBackendsTestSuite can be used as the base for any test needing simulated backends that have an origin, destination and attestation collector and a guard and notary added to each. TODO (joe): For tests that do not need all 3 simulated backends, allow them to pass in flags indicating the subset of backends desired. Some tests might only want an attestation collector, others might only want an origin and an attestation collector, others might want just a destination, etc.

func NewSimulatedBackendsTestSuite added in v0.0.54

func NewSimulatedBackendsTestSuite(tb testing.TB) *SimulatedBackendsTestSuite

NewSimulatedBackendsTestSuite creates an end-to-end test suite with simulated backends set up.

func (*SimulatedBackendsTestSuite) SetupAttestation added in v0.0.54

func (a *SimulatedBackendsTestSuite) SetupAttestation(deployManager *DeployManager)

SetupAttestation sets up the backend that will have the attestation collector contract deployed on it.

func (*SimulatedBackendsTestSuite) SetupDestination added in v0.0.54

func (a *SimulatedBackendsTestSuite) SetupDestination(deployManager *DeployManager)

SetupDestination sets up the backend that will have the destination contract deployed on it.

func (*SimulatedBackendsTestSuite) SetupExecutor added in v0.0.79

func (a *SimulatedBackendsTestSuite) SetupExecutor()

SetupExecutor sets up the Executor agent.

func (*SimulatedBackendsTestSuite) SetupGuard added in v0.0.60

func (a *SimulatedBackendsTestSuite) SetupGuard()

SetupGuard sets up the Guard agent.

func (*SimulatedBackendsTestSuite) SetupNotary added in v0.0.60

func (a *SimulatedBackendsTestSuite) SetupNotary()

SetupNotary sets up the Notary agent.

func (*SimulatedBackendsTestSuite) SetupNotaryOnOrigin added in v0.0.104

func (a *SimulatedBackendsTestSuite) SetupNotaryOnOrigin()

SetupNotaryOnOrigin sets up the Notary agent on the origin chain.

func (*SimulatedBackendsTestSuite) SetupOrigin added in v0.0.54

func (a *SimulatedBackendsTestSuite) SetupOrigin(deployManager *DeployManager)

SetupOrigin sets up the backend that will have the origin contract deployed on it.

func (*SimulatedBackendsTestSuite) SetupTest added in v0.0.54

func (a *SimulatedBackendsTestSuite) SetupTest()

SetupTest sets up the test.

type TestClientDeployer added in v0.0.104

type TestClientDeployer struct {
	*deployer.BaseDeployer
}

TestClientDeployer deploys the test client.

func (TestClientDeployer) Deploy added in v0.0.104

Deploy deploys the test client.

type TipsHarnessDeployer

type TipsHarnessDeployer struct {
	*deployer.BaseDeployer
}

TipsHarnessDeployer deploys the tip harness for tester.

func (TipsHarnessDeployer) Deploy

Deploy deploys the attestation harness.

Directories

Path Synopsis
Code generated by synapse abigen DO NOT EDIT.
Code generated by synapse abigen DO NOT EDIT.

Jump to

Keyboard shortcuts

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