cltest

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 84 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootDir the root directory for cltest
	RootDir = "/tmp/chainlink_test"
	// APIKey of the fixture API user
	APIKey = "2d25e62eaf9143e993acaf48691564b2"
	// APISecret of the fixture API user.
	APISecret = "1eCP/w0llVkchejFaoBpfIGaLRxZK54lTXBCT22YLW+pdzE4Fafy/XO5LoJ2uwHi"
	// APIEmail is the email of the fixture API user
	APIEmail = "apiuser@chainlink.test"
	// Password just a password we use everywhere for testing
	Password = "password"
	// SessionSecret is the hardcoded secret solely used for test
	SessionSecret = "clsession_test_secret"
	// DefaultKey is the address of the fixture key
	DefaultKey = "0x27548a32b9aD5D64c5945EaE9Da5337bc3169D15"
	// DefaultKeyFixtureFileName is the filename of the fixture key
	DefaultKeyFixtureFileName = "testkey-27548a32b9aD5D64c5945EaE9Da5337bc3169D15.json"
	// AllowUnstarted enable an application that can be used in tests without being started
	AllowUnstarted = "allow_unstarted"
	// DefaultPeerID is the peer ID of the fixture p2p key
	DefaultPeerID = "12D3KooWCJUPKsYAnCRTQ7SUNULt4Z9qF8Uk1xadhCs7e9M711Lp"
	// A peer ID without an associated p2p key.
	NonExistentPeerID = "12D3KooWAdCzaesXyezatDzgGvCngqsBqoUqnV9PnVc46jsVt2i9"
	// DefaultOCRKeyBundleID is the ID of the fixture ocr key bundle
	DefaultOCRKeyBundleID = "54f02f2756952ee42874182c8a03d51f048b7fc245c05196af50f9266f8e444a"
	// DefaultKeyJSON is the JSON for the default key encrypted with fast scrypt and password 'password'
	DefaultKeyJSON = `` /* 514-byte string literal not displayed */
)
View Source
const (
	DBWaitTimeout = 10 * time.Second
	// DBPollingInterval can't be too short to avoid DOSing the test database
	DBPollingInterval = 100 * time.Millisecond
)
View Source
const EthMockRegisterChainID = "eth_mock_register_chain_id"

EthMockRegisterChainID registers the common case of calling eth_chainId and returns the store.config.ChainID

View Source
const EthMockRegisterGetBalance = "eth_mock_register_get_balance"

EthMockRegisterGetBalance registers eth_getBalance, which is called by the BalanceMonitor

View Source
const EthMockRegisterGetBlockByNumber = "eth_mock_register_get_block_by_number"

EthMockRegisterGetBlockByNumber registers eth_getBlockByNumber, which is called by the HeadTracker

View Source
const LenientEthMock = "lenient"

LenientEthMock flag prevents the mock eth client from panicking if an unexpected call is made

Variables

View Source
var (
	// DefaultKeyAddress is the address of the fixture key
	DefaultKeyAddress      = common.HexToAddress(DefaultKey)
	DefaultKeyAddressEIP55 models.EIP55Address
	DefaultP2PPeerID       p2ppeer.ID
	NonExistentP2PPeerID   p2ppeer.ID
	// DefaultOCRKeyBundleIDSha256 is the ID of the fixture ocr key bundle
	DefaultOCRKeyBundleIDSha256 models.Sha256Hash
)
View Source
var OracleTransactor *bind.TransactOpts

OracleTransactor represents the identity of the oracle address used in cltest

Functions

func AllExternalInitiators added in v0.6.6

func AllExternalInitiators(t testing.TB, store *strpkg.Store) []models.ExternalInitiator

func AllJobs

func AllJobs(t testing.TB, store *strpkg.Store) []models.JobSpec

func AssertError

func AssertError(t testing.TB, want bool, err error)

func AssertEthTxAttemptCountStays added in v0.9.6

func AssertEthTxAttemptCountStays(t testing.TB, store *strpkg.Store, want int) []models.EthTxAttempt

AssertEthTxAttemptCountStays asserts that the number of tx attempts remains at the provided value

func AssertRunsStays added in v0.9.0

func AssertRunsStays(t testing.TB, j models.JobSpec, store *strpkg.Store, want int) []models.JobRun

AssertRunsStays asserts that the number of job runs for a particular job remains at the provided values

func AssertServerResponse

func AssertServerResponse(t testing.TB, resp *http.Response, expectedStatusCode int)

AssertServerResponse is used to match against a client response, will print any errors returned if the request fails.

func AssertSyncEventCountStays

func AssertSyncEventCountStays(
	t testing.TB,
	orm *orm.ORM,
	want int,
)

AssertSyncEventCountStays ensures that the event sync count stays consistent for a period of time

func BigHexInt

func BigHexInt(val interface{}) hexutil.Big

BigHexInt create hexutil.Big value from given value

func BlockWithTransactions added in v0.8.2

func BlockWithTransactions(gasPrices ...int64) *types.Block

BlockWithTransactions returns a new ethereum block with transactions matching the given gas prices

func BuildInitiatorRequests

func BuildInitiatorRequests(t *testing.T, initrs []models.Initiator) []models.InitiatorRequest

func BuildTaskRequests

func BuildTaskRequests(t *testing.T, initrs []models.TaskSpec) []models.TaskSpecRequest

func CallbackOrTimeout

func CallbackOrTimeout(t testing.TB, msg string, callback func(), durationParams ...time.Duration)

func CompareOCRJobSpecs added in v0.9.6

func CompareOCRJobSpecs(t *testing.T, expected, actual models.JobSpecV2)

`require.Equal` currently has broken handling of `time.Time` values, so we have to do equality comparisons of these structs manually.

https://github.com/stretchr/testify/issues/984

func CreateBridgeTypeViaWeb

func CreateBridgeTypeViaWeb(
	t testing.TB,
	app *TestApplication,
	payload string,
) *models.BridgeTypeAuthentication

CreateBridgeTypeViaWeb creates a bridgetype via web using /v2/bridge_types

func CreateExternalInitiatorViaWeb added in v0.6.6

func CreateExternalInitiatorViaWeb(
	t testing.TB,
	app *TestApplication,
	payload string,
) *presenters.ExternalInitiatorAuthentication

CreateExternalInitiatorViaWeb creates a bridgetype via web using /v2/bridge_types

func CreateHelloWorldJobViaWeb

func CreateHelloWorldJobViaWeb(t testing.TB, app *TestApplication, url string) models.JobSpec

CreateHelloWorldJobViaWeb creates a HelloWorld JobSpec with the given MockServer Url

func CreateJobRunViaExternalInitiator added in v0.6.7

func CreateJobRunViaExternalInitiator(
	t testing.TB,
	app *TestApplication,
	j models.JobSpec,
	eia auth.Token,
	body string,
) models.JobRun

func CreateJobRunViaWeb

func CreateJobRunViaWeb(t testing.TB, app *TestApplication, j models.JobSpec, body ...string) models.JobRun

CreateJobRunViaWeb creates JobRun via web using /v2/specs/ID/runs

func CreateJobRunWithStatus

func CreateJobRunWithStatus(t testing.TB, store *strpkg.Store, job models.JobSpec, status models.RunStatus) models.JobRun

CreateJobRunWithStatus returns a new job run with the specified status that has been persisted

func CreateJobSpecViaWeb

func CreateJobSpecViaWeb(t testing.TB, app *TestApplication, job models.JobSpec) models.JobSpec

CreateJobSpecViaWeb creates a jobspec via web using /v2/specs

func CreateSpecViaWeb

func CreateSpecViaWeb(t testing.TB, app *TestApplication, spec string) models.JobSpec

CreateJobSpecViaWeb creates a jobspec via web using /v2/specs

func DecodeSessionCookie

func DecodeSessionCookie(value string) (string, error)

func EmptyCLIContext

func EmptyCLIContext() *cli.Context

func ExtractTargetAddressFromERC20EthEthCallMock

func ExtractTargetAddressFromERC20EthEthCallMock(
	t *testing.T, arg ...interface{}) common.Address

ExtractTargetAddressFromERC20EthEthCallMock extracts the contract address and the method data, for checking in a test.

func FindServiceAgreement

func FindServiceAgreement(t testing.TB, s *strpkg.Store, id string) models.ServiceAgreement

func FixtureCreateJobViaWeb

func FixtureCreateJobViaWeb(t *testing.T, app *TestApplication, path string) models.JobSpec

FixtureCreateJobViaWeb creates a job from a fixture using /v2/specs

func GetDefaultFromAddress added in v0.8.7

func GetDefaultFromAddress(t *testing.T, store *strpkg.Store) common.Address

func GetLastEthTxAttempt added in v0.9.6

func GetLastEthTxAttempt(t testing.TB, store *strpkg.Store) models.EthTxAttempt

func GetLogs added in v0.8.4

func GetLogs(t *testing.T, rv interface{}, logs EthereumLogIterator) []interface{}

GetLogs drains logs of EVM log representations. Since those log representations don't fit into a type hierarchy, this API is a bit awkward. It returns the logs as a slice of blank interface{}s, and if rv is non-nil, it must be a pointer to a slice for elements of the same type as the logs, in which case GetLogs will append the logs to it.

func Head(val interface{}) *models.Head

Head given the value convert it into an Head

func JSONFromBytes

func JSONFromBytes(t testing.TB, body []byte) models.JSON

JSONFromBytes creates JSON from a given byte array

func JSONFromFixture

func JSONFromFixture(t *testing.T, path string) models.JSON

JSONFromFixture create models.JSON from file path

func JSONFromString

func JSONFromString(t testing.TB, body string, args ...interface{}) models.JSON

JSONFromString create JSON from given body and arguments

func JSONResultFromFixture

func JSONResultFromFixture(t *testing.T, path string) models.JSON

JSONResultFromFixture create model.JSON with params.result found in the given file path

func JobRunStays

func JobRunStays(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
	status models.RunStatus,
	optionalDuration ...time.Duration,
) models.JobRun

JobRunStays tests if a JobRun will consistently stay at the specified status

func JobRunStaysPendingIncomingConfirmations added in v0.8.4

func JobRunStaysPendingIncomingConfirmations(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
) models.JobRun

JobRunStaysPendingIncomingConfirmations tests if a JobRun will stay at the PendingIncomingConfirmations Status

func LogFromFixture

func LogFromFixture(t *testing.T, path string) models.Log

LogFromFixture create ethtypes.log from file path

func MakeConfigDigest added in v0.9.7

func MakeConfigDigest(t *testing.T) ocrtypes.ConfigDigest

func MakeOCRJobSpec added in v0.9.6

func MakeOCRJobSpec(t *testing.T, db *gorm.DB) (*offchainreporting.OracleSpec, *models.JobSpecV2)

func MakeRoundStateReturnData added in v0.8.3

func MakeRoundStateReturnData(
	roundID uint64,
	eligible bool,
	answer, startAt, timeout, availableFunds, paymentAmount, oracleCount uint64,
) []byte

func MinimalOCRNonBootstrapSpec added in v0.9.6

func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress models.EIP55Address, peerID models.PeerID, monitoringEndpoint string, keyBundleID models.Sha256Hash) string

func MustAllJobsWithStatus

func MustAllJobsWithStatus(t testing.TB, store *strpkg.Store, statuses ...models.RunStatus) []*models.JobRun

func MustBytesToConfigDigest added in v0.9.7

func MustBytesToConfigDigest(t *testing.T, b []byte) ocrtypes.ConfigDigest

func MustDefaultKey added in v0.8.11

func MustDefaultKey(t *testing.T, s *strpkg.Store) models.Key

func MustGenerateSessionCookie

func MustGenerateSessionCookie(value string) *http.Cookie

func MustGetFixtureKey added in v0.8.16

func MustGetFixtureKey(t *testing.T, store *strpkg.Store) models.Key

func MustHelloWorldAgreement added in v0.8.4

func MustHelloWorldAgreement(t *testing.T) string

MustHelloWorldAgreement returns the fixture hello world agreement

func MustHexDecode32ByteString added in v0.9.7

func MustHexDecode32ByteString(s string) [32]byte

func MustHexDecodeString added in v0.9.6

func MustHexDecodeString(s string) []byte

func MustInsertBroadcastEthTxAttempt added in v0.8.7

func MustInsertBroadcastEthTxAttempt(t *testing.T, etxID int64, store *strpkg.Store, gasPrice int64) models.EthTxAttempt

func MustInsertConfirmedEthTxWithAttempt added in v0.8.7

func MustInsertConfirmedEthTxWithAttempt(t *testing.T, store *strpkg.Store, nonce int64, broadcastBeforeBlockNum int64, fromAddress ...common.Address) models.EthTx

func MustInsertEthReceipt added in v0.8.7

func MustInsertEthReceipt(t *testing.T, s *strpkg.Store, blockNumber int64, blockHash common.Hash, txHash common.Hash) models.EthReceipt

func MustInsertFatalErrorEthTx added in v0.8.7

func MustInsertFatalErrorEthTx(t *testing.T, store *strpkg.Store) models.EthTx

func MustInsertInProgressEthTxWithAttempt added in v0.9.6

func MustInsertInProgressEthTxWithAttempt(t *testing.T, store *strpkg.Store, nonce int64, fromAddress ...common.Address) models.EthTx

func MustInsertJobSpec added in v0.9.3

func MustInsertJobSpec(t *testing.T, s *strpkg.Store) models.JobSpec

func MustInsertKey added in v0.8.7

func MustInsertKey(t *testing.T, store *strpkg.Store, address common.Address) models.Key

MustInsertKey inserts a key WARNING: Be extremely cautious using this, inserting keys with the same address in multiple parallel tests can and will lead to deadlocks. Only use this if you know what you are doing.

func MustInsertOffchainreportingOracleSpec added in v0.9.0

func MustInsertOffchainreportingOracleSpec(t *testing.T, store *strpkg.Store, dependencies ...interface{}) models.OffchainReportingOracleSpec

func MustInsertRandomKey added in v0.8.11

func MustInsertRandomKey(t *testing.T, store *strpkg.Store) models.Key

func MustInsertTaskRun added in v0.8.7

func MustInsertTaskRun(t *testing.T, store *strpkg.Store) models.ID

func MustInsertUnconfirmedEthTxWithBroadcastAttempt added in v0.8.7

func MustInsertUnconfirmedEthTxWithBroadcastAttempt(t *testing.T, store *strpkg.Store, nonce int64, fromAddress ...common.Address) models.EthTx

func MustInsertUnfinishedPipelineTaskRun added in v0.9.7

func MustInsertUnfinishedPipelineTaskRun(t *testing.T, store *strpkg.Store, pipelineRunID int64) pipeline.TaskRun

func MustJSONDel

func MustJSONDel(t *testing.T, json, path string) string

MustJSONDel uses sjson.Delete to remove a path from a JSON string and returns the string

func MustJSONSet

func MustJSONSet(t *testing.T, json, path string, value interface{}) string

MustJSONSet uses sjson.Set to set a path in a JSON string and returns the string See https://github.com/tidwall/sjson

func MustNewUser added in v0.8.4

func MustNewUser(t *testing.T, email, password string) models.User

func MustParseDuration

func MustParseDuration(t testing.TB, durationStr string) time.Duration

func MustParseURL

func MustParseURL(input string) *url.URL

func MustRandomUser added in v0.8.4

func MustRandomUser() models.User

func MustReadFile

func MustReadFile(t testing.TB, file string) []byte

MustReadFile loads a file but should never fail

func MustResultString added in v0.8.2

func MustResultString(t *testing.T, input models.RunResult) string

func NewAddress

func NewAddress() common.Address

NewAddress return a random new address

func NewBridgeType

func NewBridgeType(t testing.TB, info ...string) (*models.BridgeTypeAuthentication, *models.BridgeType)

NewBridgeType create new bridge type given info slice

func NewEIP55Address added in v0.9.3

func NewEIP55Address() models.EIP55Address

func NewEthBroadcaster added in v0.9.3

func NewEthBroadcaster(t testing.TB, store *strpkg.Store, config *TestConfig) (bulletprooftxmanager.EthBroadcaster, func())

func NewEthTx added in v0.8.7

func NewEthTx(t *testing.T, store *strpkg.Store, fromAddress ...common.Address) models.EthTx

func NewEthTxAttempt added in v0.8.7

func NewEthTxAttempt(t *testing.T, etxID int64) models.EthTxAttempt

func NewHTTPMockServer

func NewHTTPMockServer(
	t *testing.T,
	status int,
	wantMethod string,
	response string,
	callback ...func(http.Header, string),
) (*httptest.Server, func())

NewHTTPMockServer create http test server with passed in parameters

func NewHTTPMockServerWithAlterableResponse added in v0.8.4

func NewHTTPMockServerWithAlterableResponse(
	t *testing.T, response func() string) (server *httptest.Server)

func NewHash

func NewHash() common.Hash

NewHash return random Keccak256

func NewJob

func NewJob() models.JobSpec

NewJob return new NoOp JobSpec

func NewJobRun added in v0.8.2

func NewJobRun(job models.JobSpec) models.JobRun

NewJobRun returns a newly initialized job run for test purposes only

func NewJobRunPendingBridge added in v0.8.2

func NewJobRunPendingBridge(job models.JobSpec) models.JobRun

NewJobRunPendingBridge returns a new job run in the pending bridge state

func NewJobWithExternalInitiator added in v0.6.7

func NewJobWithExternalInitiator(ei *models.ExternalInitiator) models.JobSpec

NewJobWithExternalInitiator creates new Job with external initiator

func NewJobWithFluxMonitorInitiator added in v0.8.2

func NewJobWithFluxMonitorInitiator() models.JobSpec

NewJobWithFluxMonitorInitiator create new Job with FluxMonitor initiator

func NewJobWithFluxMonitorInitiatorWithBridge added in v0.8.2

func NewJobWithFluxMonitorInitiatorWithBridge() models.JobSpec

NewJobWithFluxMonitorInitiator create new Job with FluxMonitor initiator

func NewJobWithLogInitiator

func NewJobWithLogInitiator() models.JobSpec

NewJobWithLogInitiator create new Job with ethlog initiator

func NewJobWithRandomnessLog added in v0.8.12

func NewJobWithRandomnessLog() models.JobSpec

NewJobWithRandomnessLog create new Job with VRF initiator

func NewJobWithRunAtInitiator

func NewJobWithRunAtInitiator(t time.Time) models.JobSpec

NewJobWithRunAtInitiator create new Job with RunAt initiator

func NewJobWithRunLogInitiator

func NewJobWithRunLogInitiator() models.JobSpec

NewJobWithRunLogInitiator creates a new JobSpec with the RunLog initiator

func NewJobWithSchedule

func NewJobWithSchedule(sched string) models.JobSpec

NewJobWithSchedule create new job with the given schedule

func NewJobWithWebInitiator

func NewJobWithWebInitiator() models.JobSpec

NewJobWithWebInitiator create new Job with web initiator

func NewMockAuthenticatedHTTPClient

func NewMockAuthenticatedHTTPClient(cfg orm.ConfigReader, sessionID string) cmd.HTTPClient

func NewPeerID added in v0.9.3

func NewPeerID() p2ppeer.ID

func NewPipelineORM added in v0.9.3

func NewPipelineORM(t testing.TB, config *TestConfig, db *gorm.DB) (pipeline.ORM, postgres.EventBroadcaster, func())

func NewPollingDeviationChecker added in v0.8.3

func NewPollingDeviationChecker(t *testing.T, s *strpkg.Store) *fluxmonitor.PollingDeviationChecker

func NewRandomInt64 added in v0.8.4

func NewRandomInt64() int64

func NewRandomnessRequestLog added in v0.8.2

func NewRandomnessRequestLog(t *testing.T, r models.RandomnessRequestLog,
	emitter common.Address, blk int) models.Log

NewRandomnessRequestLog(t, r, emitter, blk) is a RandomnessRequest log for the randomness request log represented by r.

func NewRoundStateForRoundID added in v0.9.7

func NewRoundStateForRoundID(store *strpkg.Store, roundID uint32, latestAnswer *big.Int) contracts.FluxAggregatorRoundState

func NewRunInput added in v0.8.2

func NewRunInput(value models.JSON) models.RunInput

func NewRunInputWithResult added in v0.8.2

func NewRunInputWithResult(value interface{}) models.RunInput

func NewRunInputWithResultAndJobRunID added in v0.8.2

func NewRunInputWithResultAndJobRunID(value interface{}, jobRunID *models.ID) models.RunInput

func NewRunInputWithString added in v0.8.2

func NewRunInputWithString(t testing.TB, value string) models.RunInput

func NewRunLog

func NewRunLog(
	t *testing.T,
	jobID *models.ID,
	emitter common.Address,
	requester common.Address,
	blk int,
	json string,
) models.Log

NewRunLog create models.Log for given jobid, address, block, and json

func NewSession

func NewSession(optionalSessionID ...string) models.Session

func NewStore

func NewStore(t testing.TB, flagsAndDeps ...interface{}) (*strpkg.Store, func())

NewStore creates a new store

func NewStoreWithConfig

func NewStoreWithConfig(config *TestConfig, flagsAndDeps ...interface{}) (*strpkg.Store, func())

NewStoreWithConfig creates a new store with given config

func NewTask

func NewTask(t *testing.T, taskType string, json ...string) models.TaskSpec

NewTask given the tasktype and json params return a TaskSpec

func NewWSServer

func NewWSServer(msg string, callback func(data []byte)) (*httptest.Server, string, func())

NewWSServer returns a new wsserver

func NormalizedJSON

func NormalizedJSON(t testing.TB, input []byte) string

func NullableTime

func NullableTime(t time.Time) null.Time

NullableTime will return a valid nullable time given time.Time

func ParseISO8601

func ParseISO8601(t testing.TB, s string) time.Time

ParseISO8601 given the time string it Must parse the time and return it

func ParseJSON

func ParseJSON(t testing.TB, body io.Reader) models.JSON

func ParseJSONAPIErrors

func ParseJSONAPIErrors(t testing.TB, body io.Reader) *models.JSONAPIErrors

func ParseJSONAPIResponse

func ParseJSONAPIResponse(t testing.TB, resp *http.Response, resource interface{}) error

ParseJSONAPIResponse parses the response and returns the JSONAPI resource.

func ParseJSONAPIResponseMeta

func ParseJSONAPIResponseMeta(input []byte) (map[string]*json.RawMessage, error)

ParseJSONAPIResponseMeta parses the bytes of the root document and returns a map of *json.RawMessage's within the 'meta' key.

func ParseJSONAPIResponseMetaCount

func ParseJSONAPIResponseMetaCount(input []byte) (int, error)

ParseJSONAPIResponseMetaCount parses the bytes of the root document and returns the value of the 'count' key from the 'meta' section.

func ParseNullableTime

func ParseNullableTime(t testing.TB, s string) null.Time

ParseNullableTime given a time string parse it into a null.Time

func ParseResponseBody

func ParseResponseBody(t testing.TB, resp *http.Response) []byte

ParseResponseBody will parse the given response into a byte slice

func Random32Byte added in v0.9.0

func Random32Byte() (b [32]byte)

func RandomizeNonce added in v0.9.6

func RandomizeNonce(t *testing.T, s *strpkg.Store)

func ReadLogs

func ReadLogs(config orm.ConfigReader) (string, error)

ReadLogs returns the contents of the applications log file as a string

func ServiceAgreementFromString

func ServiceAgreementFromString(str string) (models.ServiceAgreement, error)

func StoredVRFKey added in v0.8.2

func StoredVRFKey(t *testing.T, store *strpkg.Store) *vrfkey.PublicKey

StoredVRFKey creates a VRFKeyStore on store, imports a known VRF key into it, and returns the corresponding public key.

func StringToHash

func StringToHash(s string) common.Hash

func StringToVersionedLogData20190207withoutIndexes

func StringToVersionedLogData20190207withoutIndexes(
	t *testing.T,
	internalID string,
	requester common.Address,
	str string,
) []byte

func TxReceiptFromFixture

func TxReceiptFromFixture(t *testing.T, path string) *types.Receipt

TxReceiptFromFixture create ethtypes.log from file path

func UnauthenticatedPatch

func UnauthenticatedPatch(t testing.TB, url string, body io.Reader, headers map[string]string) (*http.Response, func())

func UnauthenticatedPost added in v0.6.7

func UnauthenticatedPost(t testing.TB, url string, body io.Reader, headers map[string]string) (*http.Response, func())

func UpdateJobRunViaWeb

func UpdateJobRunViaWeb(
	t testing.TB,
	app *TestApplication,
	jr models.JobRun,
	bta *models.BridgeTypeAuthentication,
	body string,
) models.JobRun

UpdateJobRunViaWeb updates jobrun via web using /v2/runs/ID

func WaitForEthTxAttemptCount added in v0.9.6

func WaitForEthTxAttemptCount(t testing.TB, store *strpkg.Store, want int) []models.EthTxAttempt

func WaitForEthTxAttemptsForEthTx added in v0.9.6

func WaitForEthTxAttemptsForEthTx(t testing.TB, store *strpkg.Store, ethTx models.EthTx) []models.EthTxAttempt

func WaitForJobRunStatus

func WaitForJobRunStatus(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
	status models.RunStatus,
) models.JobRun

WaitForJobRunStatus waits for a JobRun to reach given status

func WaitForJobRunToComplete

func WaitForJobRunToComplete(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToComplete waits for a JobRun to reach Completed Status

func WaitForJobRunToPendBridge

func WaitForJobRunToPendBridge(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToPendBridge waits for a JobRun to reach PendingBridge Status

func WaitForJobRunToPendIncomingConfirmations added in v0.8.4

func WaitForJobRunToPendIncomingConfirmations(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToPendIncomingConfirmations waits for a JobRun to reach PendingIncomingConfirmations Status

func WaitForJobRunToPendOutgoingConfirmations added in v0.8.4

func WaitForJobRunToPendOutgoingConfirmations(
	t testing.TB,
	store *strpkg.Store,
	jr models.JobRun,
) models.JobRun

WaitForJobRunToPendOutgoingConfirmations waits for a JobRun to reach PendingOutgoingConfirmations Status

func WaitForRuns

func WaitForRuns(t testing.TB, j models.JobSpec, store *strpkg.Store, want int) []models.JobRun

WaitForRuns waits for the wanted number of runs then returns a slice of the JobRuns

func WaitForRunsAtLeast

func WaitForRunsAtLeast(t testing.TB, j models.JobSpec, store *strpkg.Store, want int)

WaitForRunsAtLeast waits for at least the passed number of runs to start.

func WaitForSyncEventCount

func WaitForSyncEventCount(
	t testing.TB,
	orm *orm.ORM,
	want int,
)

WaitForSyncEventCount checks if the sync event count eventually reaches the amound specified in parameter want.

func WaitForTxInMempool added in v0.9.6

func WaitForTxInMempool(t *testing.T, client *backends.SimulatedBackend, txHash common.Hash)

func WebURL

func WebURL(t testing.TB, unparsed string) models.WebURL

WebURL parses a url into a models.WebURL

Types

type Awaiter added in v0.9.3

type Awaiter chan struct{}

func NewAwaiter added in v0.9.3

func NewAwaiter() Awaiter

func (Awaiter) AwaitOrFail added in v0.9.3

func (a Awaiter) AwaitOrFail(t testing.TB, d time.Duration)

func (Awaiter) ItHappened added in v0.9.3

func (a Awaiter) ItHappened()

type BlockedRunner

type BlockedRunner struct {
	Done chan struct{}
}

BlockedRunner is a Runner that blocks until its channel is posted to

func (BlockedRunner) Run

Run runs the blocked runner, doesn't return until the channel is signalled

type CallbackAuthenticator

type CallbackAuthenticator struct {
	Callback func(*store.Store, string) (string, error)
}

CallbackAuthenticator contains a call back authenticator method

func (CallbackAuthenticator) Authenticate

func (a CallbackAuthenticator) Authenticate(store *store.Store, pwd string) (string, error)

Authenticate authenticates store and pwd with the callback authenticator

func (CallbackAuthenticator) AuthenticateOCRKey added in v0.9.3

func (a CallbackAuthenticator) AuthenticateOCRKey(*store.Store, string) error

func (CallbackAuthenticator) AuthenticateVRFKey added in v0.8.2

func (a CallbackAuthenticator) AuthenticateVRFKey(*store.Store, string) error

type EmptyRunner

type EmptyRunner struct{}

EmptyRunner is an EmptyRunner

func (EmptyRunner) Run

Run runs the empty runner

type EthMock

type EthMock struct {
	Responses         []MockResponse
	OptionalResponses map[string]MockResponse
	Subscriptions     []*MockSubscription
	// contains filtered or unexported fields
}

EthMock is a mock ethereum client

func MockEthOnStore

func MockEthOnStore(t testing.TB, s *store.Store, flagsAndDependencies ...interface{}) *EthMock

MockEthOnStore given store return new EthMock Client TODO(sam): Remove this function entirely and pass in eth client via dependency injection in NewApplication See: https://www.pivotaltracker.com/story/show/171753295

func (*EthMock) AllCalled

func (mock *EthMock) AllCalled() bool

AllCalled return true if all mocks have been mocked

func (*EthMock) AssertAllCalled

func (mock *EthMock) AssertAllCalled()

AssertAllCalled immediately checks that all calls have been made

func (*EthMock) BalanceAt added in v0.8.13

func (mock *EthMock) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*EthMock) BatchCallContext added in v0.8.13

func (mock *EthMock) BatchCallContext(ctx context.Context, elems []rpc.BatchElem) error

func (*EthMock) BlockByNumber added in v0.8.13

func (mock *EthMock) BlockByNumber(ctx context.Context, number *big.Int) (*gethTypes.Block, error)

func (*EthMock) Call

func (mock *EthMock) Call(result interface{}, method string, args ...interface{}) error

func (*EthMock) CallContext added in v0.8.13

func (mock *EthMock) CallContext(_ context.Context, result interface{}, method string, args ...interface{}) error

Call will call given method and set the result

func (*EthMock) CallContract added in v0.8.13

func (mock *EthMock) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*EthMock) ChainID added in v0.8.13

func (mock *EthMock) ChainID(ctx context.Context) (*big.Int, error)

func (*EthMock) Close added in v0.8.13

func (mock *EthMock) Close()

func (*EthMock) CodeAt added in v0.8.13

func (mock *EthMock) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*EthMock) Context

func (mock *EthMock) Context(context string, callback func(*EthMock))

Context adds helpful context to EthMock values set in the callback function.

func (*EthMock) EstimateGas added in v0.9.0

func (mock *EthMock) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)

func (*EthMock) EthSubscribe

func (mock *EthMock) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (ethereum.Subscription, error)

func (*EthMock) EventuallyAllCalled

func (mock *EthMock) EventuallyAllCalled(t *testing.T)

EventuallyAllCalled eventually will return after all the mock subscriptions and responses are called

func (*EthMock) FilterLogs added in v0.8.13

func (mock *EthMock) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]gethTypes.Log, error)

func (*EthMock) HeaderByNumber added in v0.8.13

func (mock *EthMock) HeaderByNumber(ctx context.Context, number *big.Int) (*gethTypes.Header, error)

func (*EthMock) PendingCodeAt added in v0.9.0

func (mock *EthMock) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*EthMock) PendingNonceAt added in v0.8.13

func (mock *EthMock) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*EthMock) Register

func (mock *EthMock) Register(
	method string,
	response interface{},
	callback ...func(interface{}, ...interface{}) error,
)

Register register mock responses and append to Ethmock

func (*EthMock) RegisterError

func (mock *EthMock) RegisterError(method, errMsg string)

RegisterError register mock errors to EthMock

func (*EthMock) RegisterNewHead

func (mock *EthMock) RegisterNewHead(blockNumber int64) chan *models.Head

RegisterNewHead register new head at given blocknumber

func (*EthMock) RegisterNewHeads

func (mock *EthMock) RegisterNewHeads() chan *models.Head

RegisterNewHeads registers a newheads subscription

func (*EthMock) RegisterOptional added in v0.8.13

func (mock *EthMock) RegisterOptional(method string, response interface{})

func (*EthMock) RegisterSubscription

func (mock *EthMock) RegisterSubscription(name string, channels ...interface{}) *MockSubscription

RegisterSubscription register a mock subscription to the given name and channels

func (*EthMock) Remaining

func (mock *EthMock) Remaining() string

func (*EthMock) SendTransaction added in v0.8.13

func (mock *EthMock) SendTransaction(ctx context.Context, tx *gethTypes.Transaction) error

func (*EthMock) ShouldCall

func (mock *EthMock) ShouldCall(setup func(mock *EthMock)) ethMockDuring

func (*EthMock) SubscribeFilterLogs added in v0.8.13

func (mock *EthMock) SubscribeFilterLogs(
	ctx context.Context,
	q ethereum.FilterQuery,
	channel chan<- gethTypes.Log,
) (ethereum.Subscription, error)

SubscribeFilterLogs registers a log subscription to the channel

func (*EthMock) SubscribeNewHead added in v0.8.13

func (mock *EthMock) SubscribeNewHead(
	ctx context.Context,
	channel chan<- *models.Head,
) (ethereum.Subscription, error)

SubscribeNewHead registers a block head subscription to the channel

func (*EthMock) SuggestGasPrice added in v0.9.0

func (mock *EthMock) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*EthMock) TransactionReceipt added in v0.8.13

func (mock *EthMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*gethTypes.Receipt, error)

type EthereumLogIterator added in v0.8.4

type EthereumLogIterator interface{ Next() bool }

EthereumLogIterator is the interface provided by gethwrapper representations of EVM logs.

type EventWebSocketServer

type EventWebSocketServer struct {
	*httptest.Server

	Connected chan struct{}
	Received  chan string
	URL       *url.URL
	// contains filtered or unexported fields
}

EventWebSocketServer is a web socket server designed specifically for testing

func NewEventWebSocketServer

func NewEventWebSocketServer(t *testing.T) (*EventWebSocketServer, func())

NewEventWebSocketServer returns a new EventWebSocketServer

func (*EventWebSocketServer) Broadcast

func (wss *EventWebSocketServer) Broadcast(message string) error

Broadcast sends a message to every web socket client connected to the EventWebSocketServer

func (*EventWebSocketServer) WriteCloseMessage

func (wss *EventWebSocketServer) WriteCloseMessage()

WriteCloseMessage tells connected clients to disconnect. Useful to emulate that the websocket server is shutting down without actually shutting down. This overcomes httptest.Server's inability to restart on the same URL:port.

type HTTPClientCleaner

type HTTPClientCleaner struct {
	HTTPClient cmd.HTTPClient
	// contains filtered or unexported fields
}

func (*HTTPClientCleaner) Delete

func (r *HTTPClientCleaner) Delete(path string) (*http.Response, func())

func (*HTTPClientCleaner) Get

func (r *HTTPClientCleaner) Get(path string, headers ...map[string]string) (*http.Response, func())

func (*HTTPClientCleaner) Patch

func (r *HTTPClientCleaner) Patch(path string, body io.Reader, headers ...map[string]string) (*http.Response, func())

func (*HTTPClientCleaner) Post

func (r *HTTPClientCleaner) Post(path string, body io.Reader) (*http.Response, func())

func (*HTTPClientCleaner) Put added in v0.8.2

func (r *HTTPClientCleaner) Put(path string, body io.Reader) (*http.Response, func())

type InstanceAppFactory

type InstanceAppFactory struct {
	App chainlink.Application
}

InstanceAppFactory is an InstanceAppFactory

func (InstanceAppFactory) NewApplication

func (f InstanceAppFactory) NewApplication(config *orm.Config, onConnectCallbacks ...func(chainlink.Application)) chainlink.Application

NewApplication creates a new application with specified config

type InstantClock

type InstantClock struct{}

InstantClock an InstantClock

func (InstantClock) After

func (InstantClock) After(_ time.Duration) <-chan time.Time

After return channel of time

func (InstantClock) Now

func (InstantClock) Now() time.Time

Now returns the current local time

type MockAPIInitializer

type MockAPIInitializer struct {
	Count int
}

func (*MockAPIInitializer) Initialize

func (m *MockAPIInitializer) Initialize(store *store.Store) (models.User, error)

type MockChangePasswordPrompter

type MockChangePasswordPrompter struct {
	models.ChangePasswordRequest
	// contains filtered or unexported fields
}

func (MockChangePasswordPrompter) Prompt

type MockCookieAuthenticator

type MockCookieAuthenticator struct {
	SessionID string
	Error     error
}

func (MockCookieAuthenticator) Authenticate

func (MockCookieAuthenticator) Cookie

func (m MockCookieAuthenticator) Cookie() (*http.Cookie, error)

type MockCountingPrompter

type MockCountingPrompter struct {
	T              *testing.T
	EnteredStrings []string
	Count          int
	NotTerminal    bool
}

MockCountingPrompter is a mock counting prompt

func (*MockCountingPrompter) IsTerminal

func (p *MockCountingPrompter) IsTerminal() bool

IsTerminal always returns true in tests

func (*MockCountingPrompter) PasswordPrompt

func (p *MockCountingPrompter) PasswordPrompt(string) string

PasswordPrompt returns an entered string

func (*MockCountingPrompter) Prompt

func (p *MockCountingPrompter) Prompt(string) string

Prompt returns an entered string

type MockCron

type MockCron struct {
	Entries []MockCronEntry
	// contains filtered or unexported fields
}

MockCron represents a mock cron

func NewMockCron

func NewMockCron() *MockCron

NewMockCron returns a new mock cron

func (*MockCron) AddFunc

func (mc *MockCron) AddFunc(schd string, fn func()) (cron.EntryID, error)

AddFunc appends a schedule to mockcron entries

func (*MockCron) RunEntries

func (mc *MockCron) RunEntries()

RunEntries run every function for each mockcron entry

func (*MockCron) Start

func (*MockCron) Start()

Start starts the mockcron

func (*MockCron) Stop

func (*MockCron) Stop() context.Context

Stop stops the mockcron

type MockCronEntry

type MockCronEntry struct {
	Schedule string
	Function func()
}

MockCronEntry a cron schedule and function

type MockHeadTrackable

type MockHeadTrackable struct {
	ConnectedCallback func(bn *models.Head)
	// contains filtered or unexported fields
}

MockHeadTrackable allows you to mock HeadTrackable

func (*MockHeadTrackable) Connect

func (m *MockHeadTrackable) Connect(bn *models.Head) error

Connect increases the connected count by one

func (*MockHeadTrackable) ConnectedCount

func (m *MockHeadTrackable) ConnectedCount() int32

ConnectedCount returns the count of connections made, safely.

func (*MockHeadTrackable) Disconnect

func (m *MockHeadTrackable) Disconnect()

Disconnect increases the disconnected count by one

func (*MockHeadTrackable) DisconnectedCount

func (m *MockHeadTrackable) DisconnectedCount() int32

DisconnectedCount returns the count of disconnections made, safely.

func (*MockHeadTrackable) OnNewLongestChain added in v0.8.5

func (m *MockHeadTrackable) OnNewLongestChain(context.Context, models.Head)

OnNewLongestChain increases the OnNewLongestChainCount count by one

func (*MockHeadTrackable) OnNewLongestChainCount added in v0.8.5

func (m *MockHeadTrackable) OnNewLongestChainCount() int32

OnNewLongestChainCount returns the count of new heads, safely.

type MockPasswordPrompter

type MockPasswordPrompter struct {
	Password string
}

func (MockPasswordPrompter) Prompt

func (m MockPasswordPrompter) Prompt() string

type MockResponse

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

MockResponse a mock response

type MockResultFunc added in v0.8.13

type MockResultFunc func(args ...interface{}) interface{}

type MockSessionRequestBuilder

type MockSessionRequestBuilder struct {
	Count int
	Error error
}

func (*MockSessionRequestBuilder) Build

type MockSigner

type MockSigner struct{}

func (MockSigner) SignHash added in v0.6.10

func (s MockSigner) SignHash(common.Hash) (models.Signature, error)

type MockSubscription

type MockSubscription struct {
	Errors chan error
	// contains filtered or unexported fields
}

MockSubscription a mock subscription

func EmptyMockSubscription

func EmptyMockSubscription() *MockSubscription

EmptyMockSubscription return empty MockSubscription

func (*MockSubscription) Err

func (mes *MockSubscription) Err() <-chan error

Err returns error channel from mes

func (*MockSubscription) Unsubscribe

func (mes *MockSubscription) Unsubscribe()

Unsubscribe closes the subscription

type NeverSleeper

type NeverSleeper struct{}

NeverSleeper is a struct that never sleeps

func (NeverSleeper) After

func (ns NeverSleeper) After() time.Duration

After returns a duration

func (NeverSleeper) Duration

func (ns NeverSleeper) Duration() time.Duration

Duration returns a duration

func (NeverSleeper) Reset

func (ns NeverSleeper) Reset()

Reset resets the never sleeper

func (NeverSleeper) Sleep

func (ns NeverSleeper) Sleep()

Sleep puts the never sleeper to sleep

type RendererMock

type RendererMock struct {
	Renders []interface{}
}

RendererMock a mock renderer

func (*RendererMock) Render

func (rm *RendererMock) Render(v interface{}) error

Render appends values to renderer mock

type SimulatedBackendClient added in v0.8.4

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

SimulatedBackendClient is an eth.Client implementation using a simulated blockchain backend. Note that not all RPC methods are implemented here.

func (*SimulatedBackendClient) BalanceAt added in v0.8.13

func (c *SimulatedBackendClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*SimulatedBackendClient) BlockByNumber added in v0.8.13

func (c *SimulatedBackendClient) BlockByNumber(ctx context.Context, n *big.Int) (*types.Block, error)

func (*SimulatedBackendClient) Call added in v0.8.4

func (c *SimulatedBackendClient) Call(result interface{}, method string, args ...interface{}) error

Call mocks the ethereum client RPC calls used by chainlink, copying the return value into result.

func (*SimulatedBackendClient) CallContext added in v0.8.13

func (c *SimulatedBackendClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error

func (*SimulatedBackendClient) CallContract added in v0.8.13

func (c *SimulatedBackendClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*SimulatedBackendClient) ChainID added in v0.8.13

GetChainID returns the ethereum ChainID.

func (*SimulatedBackendClient) Close added in v0.8.4

func (c *SimulatedBackendClient) Close()

Close terminates the underlying blockchain's update loop.

func (*SimulatedBackendClient) CodeAt added in v0.8.13

func (c *SimulatedBackendClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*SimulatedBackendClient) Dial added in v0.8.13

func (*SimulatedBackendClient) EstimateGas added in v0.9.0

func (c *SimulatedBackendClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

func (*SimulatedBackendClient) FilterLogs added in v0.8.13

func (c *SimulatedBackendClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)

FilterLogs returns all logs that respect the passed filter query.

func (*SimulatedBackendClient) GetERC20Balance added in v0.8.4

func (c *SimulatedBackendClient) GetERC20Balance(address common.Address, contractAddress common.Address) (balance *big.Int, err error)

GetERC20Balance returns the balance of the given address for the token contract address.

func (*SimulatedBackendClient) GetLINKBalance added in v0.9.6

func (c *SimulatedBackendClient) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error)

func (*SimulatedBackendClient) HeaderByNumber added in v0.8.13

func (c *SimulatedBackendClient) HeaderByNumber(ctx context.Context, n *big.Int) (*models.Head, error)

func (*SimulatedBackendClient) PendingCodeAt added in v0.9.0

func (c *SimulatedBackendClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*SimulatedBackendClient) PendingNonceAt added in v0.8.13

func (c *SimulatedBackendClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*SimulatedBackendClient) SendRawTx added in v0.8.4

func (c *SimulatedBackendClient) SendRawTx(txBytes []byte) (txHash common.Hash, err error)

SendRawTx sends a signed transaction to the transaction pool.

func (*SimulatedBackendClient) SendTransaction added in v0.8.13

func (c *SimulatedBackendClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*SimulatedBackendClient) SubscribeFilterLogs added in v0.8.13

func (c *SimulatedBackendClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, channel chan<- types.Log) (ethereum.Subscription, error)

SubscribeToLogs registers a subscription for push notifications of logs from a given address.

func (*SimulatedBackendClient) SubscribeNewHead added in v0.8.13

func (c *SimulatedBackendClient) SubscribeNewHead(
	ctx context.Context,
	channel chan<- *models.Head,
) (ethereum.Subscription, error)

SubscribeToNewHeads registers a subscription for push notifications of new blocks.

func (*SimulatedBackendClient) SuggestGasPrice added in v0.9.0

func (c *SimulatedBackendClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*SimulatedBackendClient) TransactionReceipt added in v0.8.13

func (c *SimulatedBackendClient) TransactionReceipt(ctx context.Context, receipt common.Hash) (*types.Receipt, error)

TransactionReceipt returns the transaction receipt for the given transaction hash.

type TestApplication

type TestApplication struct {
	*chainlink.ChainlinkApplication
	Config *TestConfig
	Server *httptest.Server

	Started bool
	EthMock *EthMock
	Backend *backends.SimulatedBackend
	// contains filtered or unexported fields
}

TestApplication holds the test application and test servers

func NewApplication

func NewApplication(t testing.TB, flagsAndDeps ...interface{}) (*TestApplication, func())

NewApplication creates a New TestApplication along with a NewConfig It mocks the keystore with no keys or accounts by default

func NewApplicationWithConfig

func NewApplicationWithConfig(t testing.TB, tc *TestConfig, flagsAndDeps ...interface{}) (*TestApplication, func())

NewApplicationWithConfig creates a New TestApplication with specified test config

func NewApplicationWithConfigAndKey

func NewApplicationWithConfigAndKey(t testing.TB, tc *TestConfig, flagsAndDeps ...interface{}) (*TestApplication, func())

NewApplicationWithConfigAndKey creates a new TestApplication with the given testconfig it will also provide an unlocked account on the keystore

func NewApplicationWithConfigAndKeyOnSimulatedBlockchain added in v0.8.4

func NewApplicationWithConfigAndKeyOnSimulatedBlockchain(
	t testing.TB,
	tc *TestConfig,
	backend *backends.SimulatedBackend,
	flagsAndDeps ...interface{},
) (app *TestApplication, cleanup func())

func NewApplicationWithKey

func NewApplicationWithKey(t testing.TB, flagsAndDeps ...interface{}) (*TestApplication, func())

NewApplicationWithKey creates a new TestApplication along with a new config It uses the native keystore and will load any keys that are in the database

func (*TestApplication) AddUnlockedKey

func (ta *TestApplication) AddUnlockedKey()

func (*TestApplication) ImportKey

func (ta *TestApplication) ImportKey(content string)

ImportKey adds private key to the application disk keystore, not database.

func (*TestApplication) InstantClock

func (ta *TestApplication) InstantClock() InstantClock

InstantClock create InstantClock

func (*TestApplication) MustCreateJobRun added in v0.8.2

func (ta *TestApplication) MustCreateJobRun(txHashBytes []byte, blockHashBytes []byte) *models.JobRun

func (*TestApplication) MustSeedNewSession added in v0.8.4

func (ta *TestApplication) MustSeedNewSession() string

func (*TestApplication) NewAuthenticatingClient

func (ta *TestApplication) NewAuthenticatingClient(prompter cmd.Prompter) *cmd.Client

func (*TestApplication) NewBox

func (ta *TestApplication) NewBox() packr.Box

func (*TestApplication) NewClientAndRenderer

func (ta *TestApplication) NewClientAndRenderer() (*cmd.Client, *RendererMock)

NewClientAndRenderer creates a new cmd.Client for the test application

func (*TestApplication) NewHTTPClient

func (ta *TestApplication) NewHTTPClient() HTTPClientCleaner

func (*TestApplication) Start added in v0.8.2

func (ta *TestApplication) Start() error

func (*TestApplication) StartAndConnect

func (ta *TestApplication) StartAndConnect() error

func (*TestApplication) Stop

func (ta *TestApplication) Stop() error

Stop will stop the test application and perform cleanup

type TestConfig

type TestConfig struct {
	*orm.Config
	// contains filtered or unexported fields
}

TestConfig struct with test store and wsServer

func BootstrapThrowawayORM added in v0.8.5

func BootstrapThrowawayORM(t *testing.T, name string, migrate bool, loadFixtures ...bool) (*TestConfig, *orm.ORM, func())

BootstrapThrowawayORM creates an ORM which runs in a separate database than the normal unit tests, so it you can do things like use other Postgres connection types with it.

func NewConfig

func NewConfig(t testing.TB) (*TestConfig, func())

NewConfig returns a new TestConfig

func NewConfigWithWSServer

func NewConfigWithWSServer(t testing.TB, url string, wsserver *httptest.Server) *TestConfig

NewConfigWithWSServer return new config with specified wsserver

func NewTestConfig added in v0.6.6

func NewTestConfig(t testing.TB, options ...interface{}) *TestConfig

NewTestConfig returns a test configuration

type TriggerClock

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

TriggerClock implements the AfterNower interface, but must be manually triggered to resume computation on After.

func NewTriggerClock

func NewTriggerClock(t testing.TB) *TriggerClock

NewTriggerClock returns a new TriggerClock, that a test can manually fire to continue processing in a Clock dependency.

func (*TriggerClock) After

func (t *TriggerClock) After(_ time.Duration) <-chan time.Time

After waits on a manual trigger.

func (TriggerClock) Now added in v0.8.2

func (t TriggerClock) Now() time.Time

Now returns the current local time

func (*TriggerClock) Trigger

func (t *TriggerClock) Trigger()

Trigger sends a time to unblock the After call.

func (*TriggerClock) TriggerWithoutTimeout added in v0.8.2

func (t *TriggerClock) TriggerWithoutTimeout()

TriggerWithoutTimeout is a special case where we know the trigger might block but don't care

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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