Documentation
¶
Overview ¶
Package testsuite contains the standard test suite
Index ¶
- func BigIntComparer() cmp.Option
- type SimulatedBackendsTestSuite
- func (a *SimulatedBackendsTestSuite) SetupAttestation(deployManager *testutil.DeployManager)
- func (a *SimulatedBackendsTestSuite) SetupDestination(deployManager *testutil.DeployManager)
- func (a *SimulatedBackendsTestSuite) SetupOrigin(deployManager *testutil.DeployManager)
- func (a *SimulatedBackendsTestSuite) SetupTest()
- type TestSuite
- func (s *TestSuite) DeferAfterSuite(newFunc func())
- func (s *TestSuite) DeferAfterTest(newFunc func())
- func (s *TestSuite) Eventually(willBeTrue func() bool)
- func (s *TestSuite) GetSuiteContext() context.Context
- func (s *TestSuite) GetTestContext() context.Context
- func (s *TestSuite) GetTestID() int
- func (s *TestSuite) MustMarshall(v any) []byte
- func (s *TestSuite) SetTestTimeout(timeout time.Duration)
- func (s *TestSuite) SetupSuite()
- func (s *TestSuite) SetupTest()
- func (s *TestSuite) TearDownSuite()
- func (s *TestSuite) TearDownTest()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BigIntComparer ¶ added in v0.0.2
BigIntComparer gets the big int comparer for testing.
Types ¶
type SimulatedBackendsTestSuite ¶ added in v0.0.16
type SimulatedBackendsTestSuite struct { *TestSuite OriginContract *originharness.OriginHarnessRef DestinationContract *destinationharness.DestinationHarnessRef DestinationContractMetadata contracts.DeployedContract AttestationHarness *attestationharness.AttestationHarnessRef AttestationContract *attestationcollector.AttestationCollectorRef AttestationContractMetadata contracts.DeployedContract TestBackendOrigin backends.SimulatedTestBackend TestBackendDestination backends.SimulatedTestBackend TestBackendAttestation backends.SimulatedTestBackend NotaryWallet wallet.Wallet GuardWallet wallet.Wallet NotarySigner signer.Signer GuardSigner signer.Signer OriginWallet wallet.Wallet DestinationWallet wallet.Wallet AttestationWallet wallet.Wallet OriginSigner signer.Signer DestinationSigner signer.Signer AttestationSigner signer.Signer }
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.16
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.16
func (a *SimulatedBackendsTestSuite) SetupAttestation(deployManager *testutil.DeployManager)
SetupAttestation sets up the backend that will have the attestation collector contract deployed on it.
func (*SimulatedBackendsTestSuite) SetupDestination ¶ added in v0.0.16
func (a *SimulatedBackendsTestSuite) SetupDestination(deployManager *testutil.DeployManager)
SetupDestination sets up the backend that will have the destination contract deployed on it.
func (*SimulatedBackendsTestSuite) SetupOrigin ¶ added in v0.0.16
func (a *SimulatedBackendsTestSuite) SetupOrigin(deployManager *testutil.DeployManager)
SetupOrigin sets up the backend that will have the origin contract deployed on it.
func (*SimulatedBackendsTestSuite) SetupTest ¶ added in v0.0.16
func (a *SimulatedBackendsTestSuite) SetupTest()
SetupTest sets up the test.
type TestSuite ¶
TestSuite defines the basic test suite. TODO: we should make sure global vars don't get mutated. Namely eth params.
func NewTestSuite ¶
NewTestSuite creates a new test suite and performs some basic checks afterward. Every test suite in the synapse library should inherit from this suite and override where necessary.
func (*TestSuite) DeferAfterSuite ¶
func (s *TestSuite) DeferAfterSuite(newFunc func())
DeferAfterSuite runs a function after the suite. This will run before context cancellation if you'd like to do otherwise you can from a new goroutine that watches SuiteContext() TODO: in cases of crashes this will not be done so fix this.
func (*TestSuite) DeferAfterTest ¶
func (s *TestSuite) DeferAfterTest(newFunc func())
DeferAfterTest runs a function after the test. This will run before context cancellation if you'd like to do otherwise you can from a new goroutine that watches TestContext() TODO: in cases of crashes this will not be done so fix this.
func (*TestSuite) Eventually ¶
Eventually asserts something is eventually true.
func (*TestSuite) GetSuiteContext ¶
GetSuiteContext returns the context for the test suite.
func (*TestSuite) GetTestContext ¶
GetTestContext gets the context object for the suite. This is an alias for GetTestContext() TODO: right now this is run as a test because of naming. this is mostly harmless.
func (*TestSuite) GetTestID ¶
GetTestID gets the unique test id for the current test. uniqueness is per-suite.
func (*TestSuite) MustMarshall ¶ added in v0.0.9
MustMarshall is a helper method that attempts to marshall, otherwise it fails the test.
func (*TestSuite) SetTestTimeout ¶ added in v0.0.3
SetTestTimeout will create a test timout override for the context. this will wrap s.testContext. TODO: consider enabling a value by default.
func (*TestSuite) SetupTest ¶
func (s *TestSuite) SetupTest()
SetupTest runs checks at the end of the test suite.
func (*TestSuite) TearDownSuite ¶
func (s *TestSuite) TearDownSuite()
TearDownSuite tears down the test suite.
func (*TestSuite) TearDownTest ¶
func (s *TestSuite) TearDownTest()
TearDownTest runs checks at the end of the test suite.