Documentation ¶
Index ¶
- Constants
- Variables
- func AllExternalInitiators(t testing.TB, store *strpkg.Store) []models.ExternalInitiator
- func AllJobs(t testing.TB, store *strpkg.Store) []models.JobSpec
- func AssertCount(t *testing.T, store *strpkg.Store, model interface{}, expected int64)
- func AssertCountStays(t testing.TB, store *strpkg.Store, model interface{}, want int64)
- func AssertError(t testing.TB, want bool, err error)
- func AssertEthTxAttemptCountStays(t testing.TB, store *strpkg.Store, want int) []models.EthTxAttempt
- func AssertPipelineRunsStays(t testing.TB, pipelineSpecID int32, store *strpkg.Store, want int) []pipeline.Run
- func AssertRecordEventually(t *testing.T, store *strpkg.Store, model interface{}, check func() bool)
- func AssertRunsStays(t testing.TB, j models.JobSpec, store *strpkg.Store, want int) []models.JobRun
- func AssertServerResponse(t testing.TB, resp *http.Response, expectedStatusCode int)
- func AssertSyncEventCountStays(t testing.TB, orm *orm.ORM, want int)
- func BatchElemMatchesHash(req rpc.BatchElem, hash common.Hash) bool
- func BigHexInt(val interface{}) hexutil.Big
- func BlockWithTransactions(gasPrices ...int64) *types.Block
- func BuildInitiatorRequests(t *testing.T, initrs []models.Initiator) []models.InitiatorRequest
- func BuildTaskRequests(t *testing.T, initrs []models.TaskSpec) []models.TaskSpecRequest
- func CallbackOrTimeout(t testing.TB, msg string, callback func(), durationParams ...time.Duration)
- func CompareOCRJobSpecs(t *testing.T, expected, actual job.Job)
- func CreateBridgeTypeViaWeb(t testing.TB, app *TestApplication, payload string) *webpresenters.BridgeResource
- func CreateExternalInitiatorViaWeb(t testing.TB, app *TestApplication, payload string) *presenters.ExternalInitiatorAuthentication
- func CreateHelloWorldJobViaWeb(t testing.TB, app *TestApplication, url string) models.JobSpec
- func CreateJobRunViaExternalInitiator(t testing.TB, app *TestApplication, j models.JobSpec, eia auth.Token, ...) models.JobRun
- func CreateJobRunViaWeb(t testing.TB, app *TestApplication, j models.JobSpec, body ...string) models.JobRun
- func CreateJobRunWithStatus(t testing.TB, store *strpkg.Store, job models.JobSpec, status models.RunStatus) models.JobRun
- func CreateJobSpecViaWeb(t testing.TB, app *TestApplication, job models.JobSpec) models.JobSpec
- func CreateJobViaWeb(t testing.TB, app *TestApplication, request []byte) job.Job
- func CreateJobViaWeb2(t testing.TB, app *TestApplication, spec string) webpresenters.JobResource
- func CreateSpecViaWeb(t testing.TB, app *TestApplication, spec string) models.JobSpec
- func DecodeSessionCookie(value string) (string, error)
- func EmptyCLIContext() *cli.Context
- func EventuallyExpectationsMet(t *testing.T, mock testifyExpectationsAsserter, timeout time.Duration, ...)
- func FindServiceAgreement(t testing.TB, s *strpkg.Store, id string) models.ServiceAgreement
- func FixtureCreateJobSpecV2ViaWeb(t *testing.T, app *TestApplication, path string) job.Job
- func FixtureCreateJobViaWeb(t *testing.T, app *TestApplication, path string) models.JobSpec
- func GenericEncode(types []string, values ...interface{}) ([]byte, error)
- func GetLastEthTxAttempt(t testing.TB, store *strpkg.Store) models.EthTxAttempt
- func GetLogs(t *testing.T, rv interface{}, logs EthereumLogIterator) []interface{}
- func Head(val interface{}) *models.Head
- func JSONFromBytes(t testing.TB, body []byte) models.JSON
- func JSONFromFixture(t *testing.T, path string) models.JSON
- func JSONFromString(t testing.TB, body string, args ...interface{}) models.JSON
- func JSONResultFromFixture(t *testing.T, path string) models.JSON
- func JobRunStays(t testing.TB, store *strpkg.Store, jr models.JobRun, status models.RunStatus, ...) models.JobRun
- func JobRunStaysPendingIncomingConfirmations(t testing.TB, store *strpkg.Store, jr models.JobRun) models.JobRun
- func LogFromFixture(t *testing.T, path string) types.Log
- func MakeConfigDigest(t *testing.T) ocrtypes.ConfigDigest
- func MakeRoundStateReturnData(roundID uint64, eligible bool, ...) []byte
- func Mine(backend *backends.SimulatedBackend, blockTime time.Duration) (stopMining func())
- func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress models.EIP55Address, peerID models.PeerID, ...) string
- func MockApplicationEthCalls(t *testing.T, app *TestApplication, ethClient *mocks.Client) (verify func())
- func MockFluxAggCall(client *mocks.GethClient, address common.Address, funcName string) *mock.Call
- func MockSubscribeToLogsCh(gethClient *mocks.GethClient, sub *mocks.Subscription) chan chan<- types.Log
- func MustAddKeyToKeystore(t testing.TB, key *models.Key, store *strpkg.Store)
- func MustAddRandomKeyToKeystore(t testing.TB, store *strpkg.Store, opts ...interface{}) (models.Key, common.Address)
- func MustAllJobsWithStatus(t testing.TB, store *strpkg.Store, statuses ...models.RunStatus) []*models.JobRun
- func MustBytesToConfigDigest(t *testing.T, b []byte) ocrtypes.ConfigDigest
- func MustGenerateRandomKey(t testing.TB, opts ...interface{}) models.Key
- func MustGenerateSessionCookie(value string) *http.Cookie
- func MustGenericEncode(types []string, values ...interface{}) []byte
- func MustHelloWorldAgreement(t *testing.T) string
- func MustHexDecodeString(s string) []byte
- func MustInsertBroadcastEthTxAttempt(t *testing.T, etxID int64, store *strpkg.Store, gasPrice int64) models.EthTxAttempt
- func MustInsertConfirmedEthTxWithAttempt(t *testing.T, store *strpkg.Store, nonce int64, broadcastBeforeBlockNum int64, ...) models.EthTx
- func MustInsertEthReceipt(t *testing.T, s *strpkg.Store, blockNumber int64, blockHash common.Hash, ...) models.EthReceipt
- func MustInsertFatalErrorEthTx(t *testing.T, store *strpkg.Store, fromAddress common.Address) models.EthTx
- func MustInsertHead(t *testing.T, store *strpkg.Store, number int64) models.Head
- func MustInsertInProgressEthTxWithAttempt(t *testing.T, store *strpkg.Store, nonce int64, fromAddress common.Address) models.EthTx
- func MustInsertJobSpec(t *testing.T, s *strpkg.Store) models.JobSpec
- func MustInsertKeeperJob(t *testing.T, store *strpkg.Store, from models.EIP55Address, ...) job.Job
- func MustInsertKeeperRegistry(t *testing.T, store *strpkg.Store) (keeper.Registry, job.Job)
- func MustInsertOffchainreportingOracleSpec(t *testing.T, store *strpkg.Store, transmitterAddress models.EIP55Address) job.OffchainReportingOracleSpec
- func MustInsertPipelineRun(t *testing.T, db *gorm.DB) pipeline.Run
- func MustInsertRandomKey(t testing.TB, db *gorm.DB, opts ...interface{}) models.Key
- func MustInsertSampleDirectRequestJob(t *testing.T, db *gorm.DB) job.Job
- func MustInsertTaskRun(t *testing.T, store *strpkg.Store) uuid.UUID
- func MustInsertUnconfirmedEthTxWithBroadcastAttempt(t *testing.T, store *strpkg.Store, nonce int64, fromAddress common.Address, ...) models.EthTx
- func MustInsertUnconfirmedEthTxWithInsufficientEthAttempt(t *testing.T, store *strpkg.Store, nonce int64, fromAddress common.Address) models.EthTx
- func MustInsertUnfinishedPipelineTaskRun(t *testing.T, store *strpkg.Store, pipelineRunID int64) pipeline.TaskRun
- func MustInsertUnstartedEthTx(t *testing.T, store *strpkg.Store, fromAddress common.Address) models.EthTx
- func MustInsertUpkeepForRegistry(t *testing.T, store *strpkg.Store, registry keeper.Registry) keeper.UpkeepRegistration
- func MustInsertV2JobSpec(t *testing.T, store *strpkg.Store, transmitterAddress common.Address) job.Job
- func MustJSONDel(t *testing.T, json, path string) string
- func MustJSONSet(t *testing.T, json, path string, value interface{}) string
- func MustNewJSONSerializable(t *testing.T, s string) pipeline.JSONSerializable
- func MustNewKeyedTransactor(t *testing.T, key *ecdsa.PrivateKey, chainID int64) *bind.TransactOpts
- func MustNewSimulatedBackendKeyedTransactor(t *testing.T, key *ecdsa.PrivateKey) *bind.TransactOpts
- func MustNewUser(t *testing.T, email, password string) models.User
- func MustParseDuration(t testing.TB, durationStr string) time.Duration
- func MustParseURL(input string) *url.URL
- func MustRandomBytes(t *testing.T, l int) (b []byte)
- func MustRandomUser() models.User
- func MustReadFile(t testing.TB, file string) []byte
- func MustResultString(t *testing.T, input models.RunResult) string
- func NewAddress() common.Address
- func NewBridgeType(t testing.TB, info ...string) (*models.BridgeTypeAuthentication, *models.BridgeType)
- func NewContractMockReceiver(t *testing.T, ethMock *mocks.Client, abi abi.ABI, address common.Address) contractMockReceiver
- func NewEIP55Address() models.EIP55Address
- func NewEthBroadcaster(t testing.TB, store *strpkg.Store, config *TestConfig) (bulletprooftxmanager.EthBroadcaster, func())
- func NewEthMocks(t testing.TB) (*mocks.RPCClient, *mocks.GethClient, *mocks.Subscription, func())
- func NewEthMocksWithStartupAssertions(t testing.TB) (*mocks.RPCClient, *mocks.GethClient, *mocks.Subscription, func())
- func NewEthTx(t *testing.T, store *strpkg.Store, fromAddress common.Address) models.EthTx
- func NewEthTxAttempt(t *testing.T, etxID int64) models.EthTxAttempt
- func NewHTTPMockServer(t *testing.T, status int, wantMethod string, response string, ...) (*httptest.Server, func())
- func NewHTTPMockServerWithAlterableResponse(t *testing.T, response func() string) (server *httptest.Server)
- func NewHTTPMockServerWithAlterableResponseAndRequest(t *testing.T, response func() string, callback func(r *http.Request)) (server *httptest.Server)
- func NewHTTPMockServerWithRequest(t *testing.T, status int, response string, callback func(r *http.Request)) (*httptest.Server, func())
- func NewHash() common.Hash
- func NewJob() models.JobSpec
- func NewJobRun(job models.JobSpec) models.JobRun
- func NewJobRunPendingBridge(job models.JobSpec) models.JobRun
- func NewJobWithExternalInitiator(ei *models.ExternalInitiator) models.JobSpec
- func NewJobWithFluxMonitorInitiator() models.JobSpec
- func NewJobWithFluxMonitorInitiatorWithBridge(bridgeName string) models.JobSpec
- func NewJobWithLogInitiator() models.JobSpec
- func NewJobWithRandomnessLog() models.JobSpec
- func NewJobWithRunAtInitiator(t time.Time) models.JobSpec
- func NewJobWithRunLogInitiator() models.JobSpec
- func NewJobWithSchedule(sched string) models.JobSpec
- func NewJobWithWebInitiator() models.JobSpec
- func NewMockAuthenticatedHTTPClient(cfg orm.ConfigReader, sessionID string) cmd.HTTPClient
- func NewPeerID() p2ppeer.ID
- func NewPipelineORM(t testing.TB, config *TestConfig, db *gorm.DB) (pipeline.ORM, postgres.EventBroadcaster, func())
- func NewPollingDeviationChecker(t *testing.T, s *strpkg.Store) *fluxmonitor.PollingDeviationChecker
- func NewRandomInt64() int64
- func NewRandomnessRequestLog(t *testing.T, r models.RandomnessRequestLog, emitter common.Address, blk int) types.Log
- func NewRoundStateForRoundID(store *strpkg.Store, roundID uint32, latestSubmission *big.Int) flux_aggregator_wrapper.OracleRoundState
- func NewRunInput(value models.JSON) models.RunInput
- func NewRunInputWithResult(value interface{}) models.RunInput
- func NewRunInputWithString(t testing.TB, value string) models.RunInput
- func NewRunLog(t *testing.T, jobID common.Hash, emitter common.Address, ...) types.Log
- func NewSession(optionalSessionID ...string) models.Session
- func NewSimulatedBackendIdentity(t *testing.T) *bind.TransactOpts
- func NewStore(t testing.TB, flagsAndDeps ...interface{}) (*strpkg.Store, func())
- func NewStoreWithConfig(t testing.TB, config *TestConfig, flagsAndDeps ...interface{}) (*strpkg.Store, func())
- func NewTask(t *testing.T, taskType string, json ...string) models.TaskSpec
- func NewWSServer(msg string, callback func(data []byte)) (*httptest.Server, string, func())
- func NormalizedJSON(t testing.TB, input []byte) string
- func NullableTime(t time.Time) null.Time
- func ParseISO8601(t testing.TB, s string) time.Time
- func ParseJSON(t testing.TB, body io.Reader) models.JSON
- func ParseJSONAPIErrors(t testing.TB, body io.Reader) *models.JSONAPIErrors
- func ParseJSONAPIResponse(t testing.TB, resp *http.Response, resource interface{}) error
- func ParseJSONAPIResponseMeta(input []byte) (map[string]*json.RawMessage, error)
- func ParseJSONAPIResponseMetaCount(input []byte) (int, error)
- func ParseNullableTime(t testing.TB, s string) null.Time
- func ParseResponseBody(t testing.TB, resp *http.Response) []byte
- func Random32Byte() (b [32]byte)
- func RandomLog(t *testing.T) types.Log
- func RawNewRoundLog(t *testing.T, contractAddr common.Address, blockHash common.Hash, ...) types.Log
- func ReadLogs(config orm.ConfigReader) (string, error)
- func SendBlocksUntilComplete(t testing.TB, store *strpkg.Store, jr models.JobRun, ...) models.JobRun
- func ServiceAgreementFromString(str string) (models.ServiceAgreement, error)
- func SimulateIncomingHeads(t *testing.T, args SimulateIncomingHeadsArgs) (func(), chan struct{})
- func StoredVRFKey(t *testing.T, store *strpkg.Store) *vrfkey.PublicKey
- func StringToHash(s string) common.Hash
- func StringToVersionedLogData20190207withoutIndexes(t *testing.T, internalID string, requester common.Address, str string) []byte
- func TransactionsFromGasPrices(gasPrices ...int64) []types.Transaction
- func TxReceiptFromFixture(t *testing.T, path string) *types.Receipt
- func UnauthenticatedPatch(t testing.TB, url string, body io.Reader, headers map[string]string) (*http.Response, func())
- func UnauthenticatedPost(t testing.TB, url string, body io.Reader, headers map[string]string) (*http.Response, func())
- func UpdateJobRunViaWeb(t testing.TB, app *TestApplication, jr models.JobRun, ...) models.JobRun
- func WaitForCount(t testing.TB, store *strpkg.Store, model interface{}, want int64)
- func WaitForEthTxAttemptCount(t testing.TB, store *strpkg.Store, want int) []models.EthTxAttempt
- func WaitForEthTxAttemptsForEthTx(t testing.TB, store *strpkg.Store, ethTx models.EthTx) []models.EthTxAttempt
- func WaitForJobRunStatus(t testing.TB, store *strpkg.Store, jr models.JobRun, status models.RunStatus) models.JobRun
- func WaitForJobRunToComplete(t testing.TB, store *strpkg.Store, jr models.JobRun) models.JobRun
- func WaitForJobRunToPendBridge(t testing.TB, store *strpkg.Store, jr models.JobRun) models.JobRun
- func WaitForJobRunToPendIncomingConfirmations(t testing.TB, store *strpkg.Store, jr models.JobRun) models.JobRun
- func WaitForJobRunToPendOutgoingConfirmations(t testing.TB, store *strpkg.Store, jr models.JobRun) models.JobRun
- func WaitForPipelineComplete(t testing.TB, nodeID int, jobID int32, count int, jo job.ORM, ...) []pipeline.Run
- func WaitForPipelineRuns(t testing.TB, nodeID int, jobID int32, jo job.ORM, want int, ...) []pipeline.Run
- func WaitForRuns(t testing.TB, j models.JobSpec, store *strpkg.Store, want int) []models.JobRun
- func WaitForRunsAtLeast(t testing.TB, j models.JobSpec, store *strpkg.Store, want int)
- func WaitForSpecError(t *testing.T, store *strpkg.Store, jobID models.JobID, count int) []models.JobSpecError
- func WaitForSpecErrorV2(t *testing.T, store *strpkg.Store, jobID int32, count int) []job.SpecError
- func WaitForSyncEventCount(t testing.TB, orm *orm.ORM, want int)
- func WebURL(t testing.TB, unparsed string) models.WebURL
- type Awaiter
- type BlockedRunner
- type CallbackAuthenticator
- type EmptyRunner
- type EthereumLogIterator
- type EventWebSocketServer
- type HTTPClientCleaner
- func (r *HTTPClientCleaner) Delete(path string) (*http.Response, func())
- func (r *HTTPClientCleaner) Get(path string, headers ...map[string]string) (*http.Response, func())
- func (r *HTTPClientCleaner) Patch(path string, body io.Reader, headers ...map[string]string) (*http.Response, func())
- func (r *HTTPClientCleaner) Post(path string, body io.Reader) (*http.Response, func())
- func (r *HTTPClientCleaner) Put(path string, body io.Reader) (*http.Response, func())
- type HeadTrackableFunc
- type InstanceAppFactory
- type InstantClock
- type JobPipelineV2TestHelper
- type MockAPIInitializer
- type MockChangePasswordPrompter
- type MockCookieAuthenticator
- type MockCountingPrompter
- type MockCron
- type MockCronEntry
- type MockHeadTrackable
- func (m *MockHeadTrackable) Connect(bn *models.Head) error
- func (m *MockHeadTrackable) ConnectedCount() int32
- func (m *MockHeadTrackable) Disconnect()
- func (m *MockHeadTrackable) DisconnectedCount() int32
- func (m *MockHeadTrackable) OnNewLongestChain(context.Context, models.Head)
- func (m *MockHeadTrackable) OnNewLongestChainCount() int32
- type MockPasswordPrompter
- type MockSessionRequestBuilder
- type MockSigner
- type MockSubscription
- type NeverSleeper
- type RendererMock
- type SimulateIncomingHeadsArgs
- type SimulatedBackendClient
- func (c *SimulatedBackendClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *SimulatedBackendClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *SimulatedBackendClient) BlockByNumber(ctx context.Context, n *big.Int) (*types.Block, error)
- func (c *SimulatedBackendClient) Call(result interface{}, method string, args ...interface{}) error
- func (c *SimulatedBackendClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *SimulatedBackendClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *SimulatedBackendClient) ChainID(context.Context) (*big.Int, error)
- func (c *SimulatedBackendClient) Close()
- func (c *SimulatedBackendClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *SimulatedBackendClient) Dial(context.Context) error
- func (c *SimulatedBackendClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
- func (c *SimulatedBackendClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
- func (c *SimulatedBackendClient) GetERC20Balance(address common.Address, contractAddress common.Address) (balance *big.Int, err error)
- func (c *SimulatedBackendClient) GetEthBalance(ctx context.Context, account common.Address, blockNumber *big.Int) (*assets.Eth, error)
- func (c *SimulatedBackendClient) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error)
- func (c *SimulatedBackendClient) HeaderByNumber(ctx context.Context, n *big.Int) (*models.Head, error)
- func (c *SimulatedBackendClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *SimulatedBackendClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *SimulatedBackendClient) RoundRobinBatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *SimulatedBackendClient) SendRawTx(txBytes []byte) (txHash common.Hash, err error)
- func (c *SimulatedBackendClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *SimulatedBackendClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, channel chan<- types.Log) (ethereum.Subscription, error)
- func (c *SimulatedBackendClient) SubscribeNewHead(ctx context.Context, channel chan<- *models.Head) (ethereum.Subscription, error)
- func (c *SimulatedBackendClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *SimulatedBackendClient) TransactionReceipt(ctx context.Context, receipt common.Hash) (*types.Receipt, error)
- type TestApplication
- func NewApplication(t testing.TB, flagsAndDeps ...interface{}) (*TestApplication, func())
- func NewApplicationWithConfig(t testing.TB, tc *TestConfig, flagsAndDeps ...interface{}) (*TestApplication, func())
- func NewApplicationWithConfigAndKey(t testing.TB, tc *TestConfig, flagsAndDeps ...interface{}) (*TestApplication, func())
- func NewApplicationWithConfigAndKeyOnSimulatedBlockchain(t testing.TB, tc *TestConfig, backend *backends.SimulatedBackend, ...) (app *TestApplication, cleanup func())
- func NewApplicationWithKey(t testing.TB, flagsAndDeps ...interface{}) (*TestApplication, func())
- func (ta *TestApplication) ImportKey(content string)
- func (ta *TestApplication) InstantClock() InstantClock
- func (ta *TestApplication) MustCreateJobRun(txHashBytes []byte, blockHashBytes []byte) *models.JobRun
- func (ta *TestApplication) MustSeedNewSession() string
- func (ta *TestApplication) NewAuthenticatingClient(prompter cmd.Prompter) *cmd.Client
- func (ta *TestApplication) NewBox() packr.Box
- func (ta *TestApplication) NewClientAndRenderer() (*cmd.Client, *RendererMock)
- func (ta *TestApplication) NewHTTPClient() HTTPClientCleaner
- func (ta *TestApplication) Start() error
- func (ta *TestApplication) StartAndConnect() error
- func (ta *TestApplication) Stop() error
- type TestConfig
- func BootstrapThrowawayORM(t *testing.T, name string, migrate bool, loadFixtures ...bool) (*TestConfig, *orm.ORM, func())
- func NewConfig(t testing.TB) (*TestConfig, func())
- func NewConfigWithWSServer(t testing.TB, url string, wsserver *httptest.Server) *TestConfig
- func NewTestConfig(t testing.TB, options ...interface{}) *TestConfig
- type TriggerClock
Constants ¶
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 = "p4SsW0rD1!@#_" // SessionSecret is the hardcoded secret solely used for test SessionSecret = "clsession_test_secret" // DefaultKeyAddress is the ETH address of the fixture key DefaultKeyAddress = "0xF67D0290337bca0847005C7ffD1BC75BA9AAE6e4" // DefaultKeyFixtureFileName is the filename of the fixture key DefaultKeyFixtureFileName = "testkey-0xF67D0290337bca0847005C7ffD1BC75BA9AAE6e4.json" // DefaultKeyJSON is the JSON for the default key encrypted with fast scrypt and password 'password' (used for fixture file) DefaultKeyJSON = `` /* 491-byte string literal not displayed */ // 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 = "12D3KooWApUJaQB2saFjyEUfq6BmysnsSnhLnY5CF9tURYVKgoXK" // A peer ID without an associated p2p key. NonExistentPeerID = "12D3KooWAdCzaesXyezatDzgGvCngqsBqoUqnV9PnVc46jsVt2i9" // DefaultOCRKeyBundleID is the ID of the fixture ocr key bundle DefaultOCRKeyBundleID = "7f993fb701b3410b1f6e8d4d93a7462754d24609b9b31a4fe64a0cb475a4d934" )
const ( // DBWaitTimeout is how long we wait by default for something to appear in // the DB. It needs to be fairly long because integration // tests rely on it. DBWaitTimeout = 20 * time.Second // DBPollingInterval can't be too short to avoid DOSing the test database DBPollingInterval = 100 * time.Millisecond // AssertNoActionTimeout shouldn't be too long, or it will slow down tests AssertNoActionTimeout = 3 * time.Second )
Variables ¶
var ( DefaultP2PPeerID models.PeerID NonExistentP2PPeerID models.PeerID // DefaultOCRKeyBundleIDSha256 is the ID of the fixture ocr key bundle DefaultOCRKeyBundleIDSha256 models.Sha256Hash FluxAggAddress = common.HexToAddress("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") )
Functions ¶
func AllExternalInitiators ¶
func AssertCount ¶
func AssertCountStays ¶
func AssertEthTxAttemptCountStays ¶
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 AssertPipelineRunsStays ¶
func AssertPipelineRunsStays(t testing.TB, pipelineSpecID int32, store *strpkg.Store, want int) []pipeline.Run
AssertPipelineRunsStays asserts that the number of pipeline runs for a particular job remains at the provided values
func AssertRecordEventually ¶
func AssertRunsStays ¶
AssertRunsStays asserts that the number of job runs for a particular job remains at the provided values
func AssertServerResponse ¶
AssertServerResponse is used to match against a client response, will print any errors returned if the request fails.
func AssertSyncEventCountStays ¶
AssertSyncEventCountStays ensures that the event sync count stays consistent for a period of time
func BlockWithTransactions ¶
BlockWithTransactions returns a new ethereum block with transactions matching the given gas prices
func BuildInitiatorRequests ¶
func BuildTaskRequests ¶
func CallbackOrTimeout ¶
func CompareOCRJobSpecs ¶
`require.Equal` currently has broken handling of `time.Time` values, so we have to do equality comparisons of these structs manually.
func CreateBridgeTypeViaWeb ¶
func CreateBridgeTypeViaWeb( t testing.TB, app *TestApplication, payload string, ) *webpresenters.BridgeResource
CreateBridgeTypeViaWeb creates a bridgetype via web using /v2/bridge_types
func CreateExternalInitiatorViaWeb ¶
func CreateExternalInitiatorViaWeb( t testing.TB, app *TestApplication, payload string, ) *presenters.ExternalInitiatorAuthentication
CreateExternalInitiatorViaWeb creates a bridgetype via web using /v2/bridge_types
func CreateHelloWorldJobViaWeb ¶
CreateHelloWorldJobViaWeb creates a HelloWorld JobSpec with the given MockServer Url
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 ¶
CreateJobSpecViaWeb creates a jobspec via web using /v2/specs
func CreateJobViaWeb ¶
func CreateJobViaWeb2 ¶
func CreateJobViaWeb2(t testing.TB, app *TestApplication, spec string) webpresenters.JobResource
func CreateSpecViaWeb ¶
CreateJobSpecViaWeb creates a jobspec via web using /v2/specs
func DecodeSessionCookie ¶
func EmptyCLIContext ¶
func FindServiceAgreement ¶
func FixtureCreateJobViaWeb ¶
FixtureCreateJobViaWeb creates a job from a fixture using /v2/specs
func GenericEncode ¶
GenericEncode eth encodes values based on the provided types
func GetLastEthTxAttempt ¶
func GetLogs ¶
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 JSONFromBytes ¶
JSONFromBytes creates JSON from a given byte array
func JSONFromFixture ¶
JSONFromFixture create models.JSON from file path
func JSONFromString ¶
JSONFromString create JSON from given body and arguments
func JSONResultFromFixture ¶
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 ¶
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 ¶
LogFromFixture create ethtypes.log from file path
func MakeConfigDigest ¶
func MakeConfigDigest(t *testing.T) ocrtypes.ConfigDigest
func Mine ¶
func Mine(backend *backends.SimulatedBackend, blockTime time.Duration) (stopMining func())
Mine forces the simulated backend to produce a new block every 2 seconds
func MinimalOCRNonBootstrapSpec ¶
func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress models.EIP55Address, peerID models.PeerID, keyBundleID models.Sha256Hash) string
func MockApplicationEthCalls ¶
func MockApplicationEthCalls(t *testing.T, app *TestApplication, ethClient *mocks.Client) (verify func())
MockApplicationEthCalls mocks all calls made by the chainlink application as standard when starting and stopping
func MockFluxAggCall ¶
func MockSubscribeToLogsCh ¶
func MockSubscribeToLogsCh(gethClient *mocks.GethClient, sub *mocks.Subscription) chan chan<- types.Log
func MustAddKeyToKeystore ¶
func MustAllJobsWithStatus ¶
func MustBytesToConfigDigest ¶
func MustBytesToConfigDigest(t *testing.T, b []byte) ocrtypes.ConfigDigest
func MustGenerateRandomKey ¶
func MustGenericEncode ¶
func MustHelloWorldAgreement ¶
MustHelloWorldAgreement returns the fixture hello world agreement
func MustHexDecodeString ¶
func MustInsertEthReceipt ¶
func MustInsertHead ¶
func MustInsertKeeperJob ¶
func MustInsertKeeperJob(t *testing.T, store *strpkg.Store, from models.EIP55Address, contract models.EIP55Address) job.Job
func MustInsertOffchainreportingOracleSpec ¶
func MustInsertOffchainreportingOracleSpec(t *testing.T, store *strpkg.Store, transmitterAddress models.EIP55Address) job.OffchainReportingOracleSpec
func MustInsertRandomKey ¶
MustInsertRandomKey inserts a randomly generated (not cryptographically secure) key for testing If using this with the keystore, it should be called before the keystore loads keys from the database
func MustInsertV2JobSpec ¶
func MustJSONDel ¶
MustJSONDel uses sjson.Delete to remove a path from a JSON string and returns the string
func MustJSONSet ¶
MustJSONSet uses sjson.Set to set a path in a JSON string and returns the string See https://github.com/tidwall/sjson
func MustNewJSONSerializable ¶
func MustNewJSONSerializable(t *testing.T, s string) pipeline.JSONSerializable
func MustNewKeyedTransactor ¶
func MustNewKeyedTransactor(t *testing.T, key *ecdsa.PrivateKey, chainID int64) *bind.TransactOpts
func MustNewSimulatedBackendKeyedTransactor ¶
func MustNewSimulatedBackendKeyedTransactor(t *testing.T, key *ecdsa.PrivateKey) *bind.TransactOpts
func MustParseURL ¶
func MustRandomUser ¶
func MustReadFile ¶
MustReadFile loads a file but should never fail
func NewBridgeType ¶
func NewBridgeType(t testing.TB, info ...string) (*models.BridgeTypeAuthentication, *models.BridgeType)
NewBridgeType create new bridge type given info slice
func NewContractMockReceiver ¶
func NewEIP55Address ¶
func NewEIP55Address() models.EIP55Address
func NewEthBroadcaster ¶
func NewEthBroadcaster(t testing.TB, store *strpkg.Store, config *TestConfig) (bulletprooftxmanager.EthBroadcaster, func())
func NewEthMocks ¶
func NewEthMocks(t testing.TB) (*mocks.RPCClient, *mocks.GethClient, *mocks.Subscription, func())
func NewEthMocksWithStartupAssertions ¶
func NewEthMocksWithStartupAssertions(t testing.TB) (*mocks.RPCClient, *mocks.GethClient, *mocks.Subscription, func())
func NewEthTxAttempt ¶
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 NewHTTPMockServerWithRequest ¶
func NewHTTPMockServerWithRequest( t *testing.T, status int, response string, callback func(r *http.Request), ) (*httptest.Server, func())
NewHTTPMockServerWithRequest creates http test server that makes the request available in the callback
func NewJobRunPendingBridge ¶
NewJobRunPendingBridge returns a new job run in the pending bridge state
func NewJobWithExternalInitiator ¶
func NewJobWithExternalInitiator(ei *models.ExternalInitiator) models.JobSpec
NewJobWithExternalInitiator creates new Job with external initiator
func NewJobWithFluxMonitorInitiator ¶
NewJobWithFluxMonitorInitiator create new Job with FluxMonitor initiator
func NewJobWithFluxMonitorInitiatorWithBridge ¶
NewJobWithFluxMonitorInitiator create new Job with FluxMonitor initiator
func NewJobWithLogInitiator ¶
NewJobWithLogInitiator create new Job with ethlog initiator
func NewJobWithRandomnessLog ¶
NewJobWithRandomnessLog create new Job with VRF initiator
func NewJobWithRunAtInitiator ¶
NewJobWithRunAtInitiator create new Job with RunAt initiator
func NewJobWithRunLogInitiator ¶
NewJobWithRunLogInitiator creates a new JobSpec with the RunLog initiator
func NewJobWithSchedule ¶
NewJobWithSchedule create new job with the given schedule
func NewJobWithWebInitiator ¶
NewJobWithWebInitiator create new Job with web initiator
func NewMockAuthenticatedHTTPClient ¶
func NewMockAuthenticatedHTTPClient(cfg orm.ConfigReader, sessionID string) cmd.HTTPClient
func NewPipelineORM ¶
func NewPipelineORM(t testing.TB, config *TestConfig, db *gorm.DB) (pipeline.ORM, postgres.EventBroadcaster, func())
func NewPollingDeviationChecker ¶
func NewPollingDeviationChecker(t *testing.T, s *strpkg.Store) *fluxmonitor.PollingDeviationChecker
func NewRandomInt64 ¶
func NewRandomInt64() int64
func NewRandomnessRequestLog ¶
func NewRandomnessRequestLog(t *testing.T, r models.RandomnessRequestLog, emitter common.Address, blk int) types.Log
NewRandomnessRequestLog(t, r, emitter, blk) is a RandomnessRequest log for the randomness request log represented by r.
func NewRoundStateForRoundID ¶
func NewRoundStateForRoundID(store *strpkg.Store, roundID uint32, latestSubmission *big.Int) flux_aggregator_wrapper.OracleRoundState
func NewRunInputWithResult ¶
func NewRunLog ¶
func NewRunLog( t *testing.T, jobID common.Hash, emitter common.Address, requester common.Address, blk int, json string, ) types.Log
NewRunLog create types.Log for given jobid, address, block, and json
func NewSession ¶
func NewSimulatedBackendIdentity ¶
func NewSimulatedBackendIdentity(t *testing.T) *bind.TransactOpts
newIdentity returns a go-ethereum abstraction of an ethereum account for interacting with contract golang wrappers
func NewStoreWithConfig ¶
func NewStoreWithConfig(t testing.TB, config *TestConfig, flagsAndDeps ...interface{}) (*strpkg.Store, func())
NewStoreWithConfig creates a new store with given config
func NewWSServer ¶
NewWSServer returns a new wsserver
func NullableTime ¶
NullableTime will return a valid nullable time given time.Time
func ParseISO8601 ¶
ParseISO8601 given the time string it Must parse the time and return it
func ParseJSONAPIErrors ¶
func ParseJSONAPIResponse ¶
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 ¶
ParseJSONAPIResponseMetaCount parses the bytes of the root document and returns the value of the 'count' key from the 'meta' section.
func ParseNullableTime ¶
ParseNullableTime given a time string parse it into a null.Time
func ParseResponseBody ¶
ParseResponseBody will parse the given response into a byte slice
func Random32Byte ¶
func Random32Byte() (b [32]byte)
func RawNewRoundLog ¶
func ReadLogs ¶
func ReadLogs(config orm.ConfigReader) (string, error)
ReadLogs returns the contents of the applications log file as a string
func SendBlocksUntilComplete ¶
func ServiceAgreementFromString ¶
func ServiceAgreementFromString(str string) (models.ServiceAgreement, error)
func SimulateIncomingHeads ¶
func SimulateIncomingHeads(t *testing.T, args SimulateIncomingHeadsArgs) (func(), chan struct{})
func StoredVRFKey ¶
StoredVRFKey creates a VRFKeyStore on store, imports a known VRF key into it, and returns the corresponding public key.
func StringToHash ¶
func TransactionsFromGasPrices ¶
func TransactionsFromGasPrices(gasPrices ...int64) []types.Transaction
TransactionsFromGasPrices returns transactions matching the given gas prices
func TxReceiptFromFixture ¶
TxReceiptFromFixture create ethtypes.log from file path
func UnauthenticatedPatch ¶
func UnauthenticatedPost ¶
func UpdateJobRunViaWeb ¶
func UpdateJobRunViaWeb( t testing.TB, app *TestApplication, jr models.JobRun, bridgeResource *webpresenters.BridgeResource, body string, ) models.JobRun
UpdateJobRunViaWeb updates jobrun via web using /v2/runs/ID
func WaitForCount ¶
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 ¶
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 ¶
func WaitForJobRunToPendIncomingConfirmations( t testing.TB, store *strpkg.Store, jr models.JobRun, ) models.JobRun
WaitForJobRunToPendIncomingConfirmations waits for a JobRun to reach PendingIncomingConfirmations Status
func WaitForJobRunToPendOutgoingConfirmations ¶
func WaitForJobRunToPendOutgoingConfirmations( t testing.TB, store *strpkg.Store, jr models.JobRun, ) models.JobRun
WaitForJobRunToPendOutgoingConfirmations waits for a JobRun to reach PendingOutgoingConfirmations Status
func WaitForPipelineComplete ¶
func WaitForPipelineRuns ¶
func WaitForRuns ¶
WaitForRuns waits for the wanted number of runs then returns a slice of the JobRuns
func WaitForRunsAtLeast ¶
WaitForRunsAtLeast waits for at least the passed number of runs to start.
func WaitForSpecError ¶
func WaitForSpecError(t *testing.T, store *strpkg.Store, jobID models.JobID, count int) []models.JobSpecError
Polls until the passed in jobID has count number of job spec errors.
func WaitForSpecErrorV2 ¶
WaitForSpecErrorV2 polls until the passed in jobID has count number of job spec errors.
func WaitForSyncEventCount ¶
WaitForSyncEventCount checks if the sync event count eventually reaches the amound specified in parameter want.
Types ¶
type Awaiter ¶
type Awaiter chan struct{}
func NewAwaiter ¶
func NewAwaiter() Awaiter
func (Awaiter) AwaitOrFail ¶
func (Awaiter) ItHappened ¶
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 ¶
func (r BlockedRunner) Run(app chainlink.Application) error
Run runs the blocked runner, doesn't return until the channel is signalled
type CallbackAuthenticator ¶
CallbackAuthenticator contains a call back authenticator method
func (CallbackAuthenticator) Authenticate ¶
Authenticate authenticates store and pwd with the callback authenticator
func (CallbackAuthenticator) AuthenticateOCRKey ¶
func (a CallbackAuthenticator) AuthenticateOCRKey(*store.Store, string) error
func (CallbackAuthenticator) AuthenticateVRFKey ¶
func (a CallbackAuthenticator) AuthenticateVRFKey(*store.Store, string) error
type EmptyRunner ¶
type EmptyRunner struct{}
EmptyRunner is an EmptyRunner
func (EmptyRunner) Run ¶
func (r EmptyRunner) Run(app chainlink.Application) error
Run runs the empty runner
type EthereumLogIterator ¶
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{} ReceivedText chan string ReceivedBinary chan []byte 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())
type HeadTrackableFunc ¶
func (HeadTrackableFunc) Disconnect ¶
func (HeadTrackableFunc) Disconnect()
func (HeadTrackableFunc) OnNewLongestChain ¶
func (fn HeadTrackableFunc) OnNewLongestChain(ctx context.Context, head models.Head)
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, error)
NewApplication creates a new application with specified config
type InstantClock ¶
type InstantClock struct{}
InstantClock an InstantClock
type JobPipelineV2TestHelper ¶
type JobPipelineV2TestHelper struct { Prm pipeline.ORM Eb postgres.EventBroadcaster Jrm job.ORM Pr pipeline.Runner }
func NewJobPipelineV2 ¶
func NewJobPipelineV2(t testing.TB, db *gorm.DB) JobPipelineV2TestHelper
type MockAPIInitializer ¶
type MockAPIInitializer struct {
Count int
}
func (*MockAPIInitializer) Initialize ¶
type MockChangePasswordPrompter ¶
type MockChangePasswordPrompter struct { web.UpdatePasswordRequest // contains filtered or unexported fields }
func (MockChangePasswordPrompter) Prompt ¶
func (m MockChangePasswordPrompter) Prompt() (web.UpdatePasswordRequest, error)
type MockCookieAuthenticator ¶
func (MockCookieAuthenticator) Authenticate ¶
func (m MockCookieAuthenticator) Authenticate(models.SessionRequest) (*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 (*MockCron) RunEntries ¶
func (mc *MockCron) RunEntries()
RunEntries run every function for each mockcron entry
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 ¶
func (m *MockHeadTrackable) OnNewLongestChain(context.Context, models.Head)
OnNewLongestChain increases the OnNewLongestChainCount count by one
func (*MockHeadTrackable) OnNewLongestChainCount ¶
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 MockSessionRequestBuilder ¶
func (*MockSessionRequestBuilder) Build ¶
func (m *MockSessionRequestBuilder) Build(string) (models.SessionRequest, error)
type MockSigner ¶
type MockSigner struct{}
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) Duration ¶
func (ns NeverSleeper) Duration() time.Duration
Duration returns a duration
type RendererMock ¶
type RendererMock struct {
Renders []interface{}
}
RendererMock a mock renderer
func (*RendererMock) Render ¶
func (rm *RendererMock) Render(v interface{}, headers ...string) error
Render appends values to renderer mock
type SimulatedBackendClient ¶
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) BatchCallContext ¶
func (*SimulatedBackendClient) BlockByNumber ¶
func (*SimulatedBackendClient) Call ¶
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 ¶
func (c *SimulatedBackendClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
func (*SimulatedBackendClient) CallContract ¶
func (*SimulatedBackendClient) Close ¶
func (c *SimulatedBackendClient) Close()
Close terminates the underlying blockchain's update loop.
func (*SimulatedBackendClient) EstimateGas ¶
func (c *SimulatedBackendClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
func (*SimulatedBackendClient) FilterLogs ¶
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 ¶
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) GetEthBalance ¶
func (*SimulatedBackendClient) GetLINKBalance ¶
func (*SimulatedBackendClient) HeaderByNumber ¶
func (*SimulatedBackendClient) PendingCodeAt ¶
func (*SimulatedBackendClient) PendingNonceAt ¶
func (*SimulatedBackendClient) RoundRobinBatchCallContext ¶
func (*SimulatedBackendClient) SendRawTx ¶
func (c *SimulatedBackendClient) SendRawTx(txBytes []byte) (txHash common.Hash, err error)
SendRawTx sends a signed transaction to the transaction pool.
func (*SimulatedBackendClient) SendTransaction ¶
func (c *SimulatedBackendClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
func (*SimulatedBackendClient) SubscribeFilterLogs ¶
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 ¶
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 ¶
func (*SimulatedBackendClient) TransactionReceipt ¶
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 Backend *backends.SimulatedBackend Key models.Key // 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 ¶
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) 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 ¶
func (ta *TestApplication) MustCreateJobRun(txHashBytes []byte, blockHashBytes []byte) *models.JobRun
func (*TestApplication) MustSeedNewSession ¶
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 ¶
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 ¶
TestConfig struct with test store and wsServer
func BootstrapThrowawayORM ¶
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 ¶
NewConfigWithWSServer return new config with specified wsserver
func NewTestConfig ¶
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) Trigger ¶
func (t *TriggerClock) Trigger()
Trigger sends a time to unblock the After call.
func (*TriggerClock) TriggerWithoutTimeout ¶
func (t *TriggerClock) TriggerWithoutTimeout()
TriggerWithoutTimeout is a special case where we know the trigger might block but don't care