{"modulePath":"github.com/GoPlugin/pluginV2","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cltest\n\nImporting cltest should only be for top level black box (X\\_test package) integration tests, for example testing against the Application object itself. Consider using a smaller scoped package: utils or testutils/\\* if possible.\n\n## Constants\n\n```go\nconst (\n\t// APIKey of the fixture API user\n\tAPIKey = \"2d25e62eaf9143e993acaf48691564b2\"\n\t// APISecret of the fixture API user.\n\tAPISecret = \"1eCP/w0llVkchejFaoBpfIGaLRxZK54lTXBCT22YLW+pdzE4Fafy/XO5LoJ2uwHi\"\n\t// Collection of test fixture DB user emails per role\n\tAPIEmailAdmin    = \"apiuser@chainlink.test\"\n\tAPIEmailEdit     = \"apiuser-edit@chainlink.test\"\n\tAPIEmailRun      = \"apiuser-run@chainlink.test\"\n\tAPIEmailViewOnly = \"apiuser-view-only@chainlink.test\"\n\t// Password just a password we use everywhere for testing\n\tPassword = testutils.Password\n\t// SessionSecret is the hardcoded secret solely used for test\n\tSessionSecret = \"clsession_test_secret\"\n\t// DefaultPeerID is the peer ID of the default p2p key\n\tDefaultPeerID = \"12D3KooWPjceQrSwdWXPyLLeABRXmuqt69Rg3sBYbU1Nft9HyQ6X\"\n\t// DefaultOCRKeyBundleID is the ID of the default ocr key bundle\n\tDefaultOCRKeyBundleID = \"f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5\"\n\t// DefaultOCR2KeyBundleID is the ID of the fixture ocr2 key bundle\n\tDefaultOCR2KeyBundleID = \"92be59c45d0d7b192ef88d391f444ea7c78644f8607f567aab11d53668c27a4d\"\n\t// Private key seed of test keys created with `big.NewInt(1)`, representations of value present in `scrub_logs` script\n\tKeyBigIntSeed = 1\n)\n```\n\n```go\nconst (\n\t// DBPollingInterval can't be too short to avoid DOSing the test database\n\tDBPollingInterval = 100 * time.Millisecond\n\t// AssertNoActionTimeout shouldn't be too long, or it will slow down tests\n\tAssertNoActionTimeout = 3 * time.Second\n)\n```\n\n```go\nconst (\n\tUseRealExternalInitiatorManager = \"UseRealExternalInitiatorManager\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tDefaultP2PPeerID p2pkey.PeerID\n\tFixtureChainID   = *testutils.FixtureChainID\n\n\tDefaultCSAKey        = csakey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed))\n\tDefaultOCRKey        = ocrkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed))\n\tDefaultOCR2Key       = ocr2key.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed), \"evm\")\n\tDefaultP2PKey        = p2pkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed))\n\tDefaultSolanaKey     = solkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed))\n\tDefaultStarkNetKey   = starkkey.MustNewInsecure(keystest.NewRandReaderFromSeed(KeyBigIntSeed))\n\tDefaultVRFKey        = vrfkey.MustNewV2XXXTestingOnly(big.NewInt(KeyBigIntSeed))\n\tDefaultDKGSignKey    = dkgsignkey.MustNewXXXTestingOnly(big.NewInt(KeyBigIntSeed))\n\tDefaultDKGEncryptKey = dkgencryptkey.MustNewXXXTestingOnly(big.NewInt(KeyBigIntSeed))\n)\n```\n\n## Functions\n\n```go\nfunc AllExternalInitiators(t testing.TB, db *sqlx.DB) []bridges.ExternalInitiator\n```\n\n```go\nfunc AssertCount(t *testing.T, db *sqlx.DB, tableName string, expected int64)\n```\n\n```go\nfunc AssertCountStays(t testing.TB, db *sqlx.DB, tableName string, want int64)\n```\n\n```go\nfunc AssertError(t testing.TB, want bool, err error)\n```\n\n```go\nfunc AssertEthTxAttemptCountStays(t testing.TB, db *sqlx.DB, want int) []txmgr.EthTxAttempt\n```\nAssertEthTxAttemptCountStays asserts that the number of tx attempts remains at the provided value\n\n```go\nfunc AssertPipelineRunsStays(t testing.TB, pipelineSpecID int32, db *sqlx.DB, want int) []pipeline.Run\n```\nAssertPipelineRunsStays asserts that the number of pipeline runs for a particular job remains at the provided values\n\n```go\nfunc AssertPipelineTaskRunsErrored(t testing.TB, runs []pipeline.TaskRun)\n```\n\n```go\nfunc AssertPipelineTaskRunsSuccessful(t testing.TB, runs []pipeline.TaskRun)\n```\n\n```go\nfunc AssertRecordEventually(t *testing.T, db *sqlx.DB, model interface{}, stmt string, check func() bool)\n```\n\n```go\nfunc AssertServerResponse(t testing.TB, resp *http.Response, expectedStatusCode int)\n```\nAssertServerResponse is used to match against a client response, will print any errors returned if the request fails.\n\n```go\nfunc AwaitJobActive(t testing.TB, jobSpawner job.Spawner, jobID int32, waitFor time.Duration)\n```\n\n```go\nfunc BatchElemMatchesParams(req rpc.BatchElem, arg interface{}, method string) bool\n```\n\n```go\nfunc BatchElemMustMatchParams(t *testing.T, req rpc.BatchElem, hash common.Hash, method string)\n```\n\n```go\nfunc CallbackOrTimeout(t testing.TB, msg string, callback func(), durationParams ...time.Duration)\n```\n\n```go\nfunc ClearDBTables(t *testing.T, db *sqlx.DB, tables ...string)\n```\nClearDBTables deletes all rows from the given tables\n\n```go\nfunc CreateExternalInitiatorViaWeb(\n\tt testing.TB,\n\tapp *TestApplication,\n\tpayload string,\n) *webpresenters.ExternalInitiatorAuthentication\n```\nCreateExternalInitiatorViaWeb creates a bridgetype via web using /v2/bridge\\_types\n\n```go\nfunc CreateJobRunViaExternalInitiatorV2(\n\tt testing.TB,\n\tapp *TestApplication,\n\tjobID uuid.UUID,\n\teia auth.Token,\n\tbody string,\n) webpresenters.PipelineRunResource\n```\n\n```go\nfunc CreateJobRunViaUser(\n\tt testing.TB,\n\tapp *TestApplication,\n\tjobID uuid.UUID,\n\tbody string,\n) webpresenters.PipelineRunResource\n```\n\n```go\nfunc CreateJobViaWeb(t testing.TB, app *TestApplication, request []byte) job.Job\n```\n\n```go\nfunc CreateJobViaWeb2(t testing.TB, app *TestApplication, spec string) webpresenters.JobResource\n```\n\n```go\nfunc CreateUserWithRole(t testing.TB, role sessions.UserRole) sessions.User\n```\nCreateUserWithRole inserts a new user with specified role and associated test DB email into the test DB\n\n```go\nfunc DecodeSessionCookie(value string) (string, error)\n```\n\n```go\nfunc DeleteJobViaWeb(t testing.TB, app *TestApplication, jobID int32)\n```\n\n```go\nfunc DynamicFeeTransactionsFromTipCaps(tipCaps ...int64) []evmtypes.Transaction\n```\nDynamicFeeTransactionsFromTipCaps returns EIP-1559 transactions with the given TipCaps (FeeCap is arbitrary)\n\n```go\nfunc DynamicFeeTransactionsFromTipCapsTxType(code evmtypes.TxType, tipCaps ...int64) []evmtypes.Transaction\n```\n\n```go\nfunc EmptyCLIContext() *cli.Context\n```\n\n```go\nfunc EventuallyExpectationsMet(t *testing.T, mock testifyExpectationsAsserter, timeout time.Duration, interval time.Duration)\n```\n\n```go\nfunc FlagSetApplyFromAction(action interface{}, flagSet *flag.FlagSet, parentCommand string)\n```\nFlagSetApplyFromAction applies the flags from action to the flagSet. \\`parentCommand\\` will filter the app commands and only applies the flags if the command/subcommand has a parent with that name, if left empty no filtering is done\n\n```go\nfunc GetLogs(t *testing.T, rv interface{}, logs EthereumLogIterator) []interface{}\n```\nGetLogs 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.\n\n```go\nfunc Head(val interface{}) *evmtypes.Head\n```\nHead given the value convert it into an Head\n\n```go\nfunc JSONFromBytes(t testing.TB, body []byte) models.JSON\n```\nJSONFromBytes creates JSON from a given byte array\n\n```go\nfunc JSONFromFixture(t *testing.T, path string) models.JSON\n```\nJSONFromFixture create models.JSON from file path\n\n```go\nfunc JSONFromString(t testing.TB, body string, args ...interface{}) models.JSON\n```\nJSONFromString create JSON from given body and arguments\n\n```go\nfunc LegacyTransactionsFromGasPrices(gasPrices ...int64) []evmtypes.Transaction\n```\nLegacyTransactionsFromGasPrices returns transactions matching the given gas prices\n\n```go\nfunc LegacyTransactionsFromGasPricesTxType(code evmtypes.TxType, gasPrices ...int64) []evmtypes.Transaction\n```\n\n```go\nfunc LogFromFixture(t *testing.T, path string) types.Log\n```\nLogFromFixture create ethtypes.log from file path\n\n```go\nfunc MakeConfigDigest(t *testing.T) ocrtypes.ConfigDigest\n```\n\n```go\nfunc MakeDirectRequestJobSpec(t *testing.T) *job.Job\n```\n\n```go\nfunc Mine(backend *backends.SimulatedBackend, blockTime time.Duration) (stopMining func())\n```\nMine forces the simulated backend to produce a new block every 2 seconds\n\n```go\nfunc MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress ethkey.EIP55Address, peerID p2pkey.PeerID, keyBundleID string) string\n```\n\n```go\nfunc MockApplicationEthCalls(t *testing.T, app *TestApplication, ethClient *evmMocks.Client, sub *evmMocks.Subscription)\n```\nMockApplicationEthCalls mocks all calls made by the chainlink application as standard when starting and stopping\n\n```go\nfunc MustAddKeyToKeystore(t testing.TB, key ethkey.KeyV2, chainID *big.Int, ethKeyStore keystore.Eth)\n```\n\n```go\nfunc MustAddRandomKeyToKeystore(t testing.TB, ethKeyStore keystore.Eth) (ethkey.KeyV2, common.Address)\n```\n\n```go\nfunc MustBytesToConfigDigest(t *testing.T, b []byte) ocrtypes.ConfigDigest\n```\n\n```go\nfunc MustCreateBridge(t testing.TB, db *sqlx.DB, opts BridgeOpts, cfg pg.QConfig) (bta *bridges.BridgeTypeAuthentication, bt *bridges.BridgeType)\n```\nMustCreateBridge creates a bridge Be careful not to specify a name here unless you ABSOLUTELY need to This is because name is a unique index and identical names used across transactional tests will lock/deadlock\n\n```go\nfunc MustGenerateRandomKey(t testing.TB) ethkey.KeyV2\n```\n\n```go\nfunc MustGenerateRandomKeyState(t testing.TB) ethkey.State\n```\n\n```go\nfunc MustGenerateSessionCookie(t testing.TB, value string) *http.Cookie\n```\n\n```go\nfunc MustGetStateForKey(t testing.TB, kst keystore.Eth, key ethkey.KeyV2) ethkey.State\n```\n\n```go\nfunc MustInsertConfirmedEthTxBySaveFetchedReceipts(t *testing.T, borm txmgr.ORM, fromAddress common.Address, nonce int64, blockNum int64, chainID big.Int) (etx txmgr.EthTx)\n```\n\n```go\nfunc MustInsertConfirmedEthTxWithLegacyAttempt(t *testing.T, borm txmgr.ORM, nonce int64, broadcastBeforeBlockNum int64, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc MustInsertConfirmedEthTxWithReceipt(t *testing.T, borm txmgr.ORM, fromAddress common.Address, nonce, blockNum int64) (etx txmgr.EthTx)\n```\nInserts into eth\\_receipts but does not update eth\\_txes or eth\\_tx\\_attempts\n\n```go\nfunc MustInsertConfirmedMissingReceiptEthTxWithLegacyAttempt(\n\tt *testing.T, borm txmgr.ORM, nonce int64, broadcastBeforeBlockNum int64,\n\tbroadcastAt time.Time, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc MustInsertEthReceipt(t *testing.T, borm txmgr.ORM, blockNumber int64, blockHash common.Hash, txHash common.Hash) txmgr.EthReceipt\n```\n\n```go\nfunc MustInsertExternalInitiator(t *testing.T, orm bridges.ORM) (ei bridges.ExternalInitiator)\n```\n\n```go\nfunc MustInsertExternalInitiatorWithOpts(t *testing.T, orm bridges.ORM, opts ExternalInitiatorOpts) (ei bridges.ExternalInitiator)\n```\n\n```go\nfunc MustInsertFatalErrorEthTx(t *testing.T, borm txmgr.ORM, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc MustInsertHead(t *testing.T, db *sqlx.DB, cfg pg.QConfig, number int64) evmtypes.Head\n```\n\n```go\nfunc MustInsertInProgressEthTxWithAttempt(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc MustInsertKeeperJob(t *testing.T, db *sqlx.DB, korm keeper.ORM, from ethkey.EIP55Address, contract ethkey.EIP55Address) job.Job\n```\n\n```go\nfunc MustInsertKeeperRegistry(t *testing.T, db *sqlx.DB, korm keeper.ORM, ethKeyStore keystore.Eth, keeperIndex, numKeepers, blockCountPerTurn int32) (keeper.Registry, job.Job)\n```\n\n```go\nfunc MustInsertOffchainreportingOracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress ethkey.EIP55Address) job.OCROracleSpec\n```\n\n```go\nfunc MustInsertPipelineRun(t *testing.T, db *sqlx.DB) (run pipeline.Run)\n```\n\n```go\nfunc MustInsertPipelineRunWithStatus(t *testing.T, db *sqlx.DB, pipelineSpecID int32, status pipeline.RunStatus) (run pipeline.Run)\n```\n\n```go\nfunc MustInsertPipelineSpec(t *testing.T, db *sqlx.DB) (spec pipeline.Spec)\n```\n\n```go\nfunc MustInsertRandomKey(\n\tt testing.TB,\n\tkeystore keystore.Eth,\n\topts ...interface{},\n) (ethkey.KeyV2, common.Address)\n```\nMustInsertRandomKey inserts a randomly generated (not cryptographically secure) key for testing By default it is enabled for the fixture chain\n\n```go\nfunc MustInsertRandomKeyReturningState(t testing.TB,\n\tkeystore keystore.Eth,\n\topts ...interface{},\n) (ethkey.State, common.Address)\n```\n\n```go\nfunc MustInsertRevertedEthReceipt(t *testing.T, borm txmgr.ORM, blockNumber int64, blockHash common.Hash, txHash common.Hash) txmgr.EthReceipt\n```\n\n```go\nfunc MustInsertUnconfirmedEthTx(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address, opts ...interface{}) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUnconfirmedEthTxWithAttemptState(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address, txAttemptState txmgr.EthTxAttemptState, opts ...interface{}) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUnconfirmedEthTxWithBroadcastDynamicFeeAttempt(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address, opts ...interface{}) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address, opts ...interface{}) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUnconfirmedEthTxWithInsufficientEthAttempt(t *testing.T, borm txmgr.ORM, nonce int64, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUnfinishedPipelineTaskRun(t *testing.T, db *sqlx.DB, pipelineRunID int64) (tr pipeline.TaskRun)\n```\n\n```go\nfunc MustInsertUnstartedEthTx(t *testing.T, borm txmgr.ORM, fromAddress common.Address, opts ...interface{}) txmgr.EthTx\n```\n\n```go\nfunc MustInsertUpkeepForRegistry(t *testing.T, db *sqlx.DB, cfg keeper.Config, registry keeper.Registry) keeper.UpkeepRegistration\n```\n\n```go\nfunc MustInsertV2JobSpec(t *testing.T, db *sqlx.DB, transmitterAddress common.Address) job.Job\n```\n\n```go\nfunc MustInsertWebhookSpec(t *testing.T, db *sqlx.DB) (job.Job, job.WebhookSpec)\n```\n\n```go\nfunc MustJSONMarshal(t *testing.T, val interface{}) string\n```\n\n```go\nfunc MustNewUser(t *testing.T, email, password string) sessions.User\n```\n\n```go\nfunc MustParseDuration(t testing.TB, durationStr string) time.Duration\n```\n\n```go\nfunc MustParseURL(t testing.TB, input string) *url.URL\n```\n\n```go\nfunc MustRandomBytes(t *testing.T, l int) (b []byte)\n```\n\n```go\nfunc MustRandomP2PPeerID(t *testing.T) p2ppeer.ID\n```\n\n```go\nfunc MustRandomUser(t testing.TB) sessions.User\n```\nMustRandomUser inserts a new admin user with a random email into the test DB\n\n```go\nfunc MustReadFile(t testing.TB, file string) []byte\n```\nMustReadFile loads a file but should never fail\n\n```go\nfunc MustSendingKeyStates(t *testing.T, ethKeyStore keystore.Eth, chainID *big.Int) []ethkey.State\n```\n\n```go\nfunc MustWebURL(t *testing.T, s string) *models.WebURL\n```\n\n```go\nfunc NewBridgeType(t testing.TB, opts BridgeOpts) (*bridges.BridgeTypeAuthentication, *bridges.BridgeType)\n```\nNewBridgeType create new bridge type given info slice\n\n```go\nfunc NewChainSetMockWithOneChain(t testing.TB, ethClient evmclient.Client, cfg evmconfig.ChainScopedConfig) evm.ChainSet\n```\n\n```go\nfunc NewContractMockReceiver(t *testing.T, ethMock *evmmocks.Client, abi abi.ABI, address common.Address) contractMockReceiver\n```\n\n```go\nfunc NewDynamicFeeEthTxAttempt(t *testing.T, etxID int64) txmgr.EthTxAttempt\n```\n\n```go\nfunc NewEIP55Address() ethkey.EIP55Address\n```\n\n```go\nfunc NewEthBroadcaster(t testing.TB, db *sqlx.DB, ethClient evmclient.Client, keyStore txmgr.KeyStore, config evmconfig.ChainScopedConfig, keyStates []ethkey.State, checkerFactory txmgr.TransmitCheckerFactory, nonceAutoSync bool) *txmgr.EthBroadcaster\n```\nNewEthBroadcaster creates a new txmgr.EthBroadcaster for use in testing.\n\n```go\nfunc NewEthConfirmer(t testing.TB, orm txmgr.ORM, ethClient evmclient.Client, config evmconfig.ChainScopedConfig, ks keystore.Eth, keyStates []ethkey.State, fn txmgr.ResumeCallback) *txmgr.EthConfirmer\n```\n\n```go\nfunc NewEthMocks(t testing.TB) *evmMocks.Client\n```\n\n```go\nfunc NewEthMocksWithDefaultChain(t testing.TB) (c *evmMocks.Client)\n```\n\n```go\nfunc NewEthMocksWithStartupAssertions(t testing.TB) *evmMocks.Client\n```\n\n```go\nfunc NewEthMocksWithTransactionsOnBlocksAssertions(t testing.TB) *evmMocks.Client\n```\nNewEthMocksWithTransactionsOnBlocksAssertions sets an Eth mock with transactions on blocks\n\n```go\nfunc NewEthReceipt(t *testing.T, blockNumber int64, blockHash common.Hash, txHash common.Hash, status uint64) txmgr.EthReceipt\n```\n\n```go\nfunc NewEthTx(t *testing.T, fromAddress common.Address) txmgr.EthTx\n```\n\n```go\nfunc NewEventBroadcaster(t testing.TB, dbURL url.URL) pg.EventBroadcaster\n```\n\n```go\nfunc NewHTTPMockServer(\n\tt *testing.T,\n\tstatus int,\n\twantMethod string,\n\tresponse string,\n\tcallback ...func(http.Header, string),\n) *httptest.Server\n```\nNewHTTPMockServer create http test server with passed in parameters\n\n```go\nfunc NewHTTPMockServerWithAlterableResponse(\n\tt *testing.T, response func() string) (server *httptest.Server)\n```\n\n```go\nfunc NewHTTPMockServerWithAlterableResponseAndRequest(t *testing.T, response func() string, callback func(r *http.Request)) (server *httptest.Server)\n```\n\n```go\nfunc NewHTTPMockServerWithRequest(\n\tt *testing.T,\n\tstatus int,\n\tresponse string,\n\tcallback func(r *http.Request),\n) *httptest.Server\n```\nNewHTTPMockServerWithRequest creates http test server that makes the request available in the callback\n\n```go\nfunc NewKeyStore(t testing.TB, db *sqlx.DB, cfg pg.QConfig) keystore.Master\n```\nNewKeyStore returns a new, unlocked keystore\n\n```go\nfunc NewLegacyEthTxAttempt(t *testing.T, etxID int64) txmgr.EthTxAttempt\n```\n\n```go\nfunc NewMockAuthenticatedHTTPClient(lggr logger.Logger, cfg cmd.ClientOpts, sessionID string) cmd.HTTPClient\n```\n\n```go\nfunc NewPeerID() p2ppeer.ID\n```\n\n```go\nfunc NewRandomPositiveInt64() int64\n```\n\n```go\nfunc NewSession(optionalSessionID ...string) clsessions.Session\n```\n\n```go\nfunc NewSimulatedBackend(t *testing.T, alloc core.GenesisAlloc, gasLimit uint32) *backends.SimulatedBackend\n```\n\n```go\nfunc NewTestChainScopedConfig(t testing.TB) evmconfig.ChainScopedConfig\n```\n\n```go\nfunc NewTestGeneralConfig(t testing.TB) *configtest.TestGeneralConfig\n```\nDeprecated: use configtest/v2.NewTestGeneralConfig [https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config](https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config)\n\n```go\nfunc NewTxmORM(t *testing.T, db *sqlx.DB, cfg pg.QConfig) txmgr.ORM\n```\n\n```go\nfunc NewWSServer(t *testing.T, chainID *big.Int, callback testutils.JSONRPCHandler) string\n```\nNewWSServer starts a websocket server which invokes callback for each message received. If chainID is set, then eth\\_chainId calls will be automatically handled.\n\n```go\nfunc ParseJSON(t testing.TB, body io.Reader) models.JSON\n```\n\n```go\nfunc ParseJSONAPIErrors(t testing.TB, body io.Reader) *models.JSONAPIErrors\n```\n\n```go\nfunc ParseJSONAPIResponse(t testing.TB, resp *http.Response, resource interface{}) error\n```\nParseJSONAPIResponse parses the response and returns the JSONAPI resource.\n\n```go\nfunc ParseJSONAPIResponseMeta(input []byte) (map[string]*json.RawMessage, error)\n```\nParseJSONAPIResponseMeta parses the bytes of the root document and returns a map of \\*json.RawMessage's within the 'meta' key.\n\n```go\nfunc ParseJSONAPIResponseMetaCount(input []byte) (int, error)\n```\nParseJSONAPIResponseMetaCount parses the bytes of the root document and returns the value of the 'count' key from the 'meta' section.\n\n```go\nfunc ParseResponseBody(t testing.TB, resp *http.Response) []byte\n```\nParseResponseBody will parse the given response into a byte slice\n\n```go\nfunc RandomLog(t *testing.T) types.Log\n```\n\n```go\nfunc RawNewRoundLog(t *testing.T, contractAddr common.Address, blockHash common.Hash, blockNumber uint64, logIndex uint, removed bool) types.Log\n```\n\n```go\nfunc RawNewRoundLogWithTopics(t *testing.T, contractAddr common.Address, blockHash common.Hash, blockNumber uint64, logIndex uint, removed bool, topics []common.Hash) types.Log\n```\n\n```go\nfunc RequireTxSuccessful(t testing.TB, client TransactionReceipter, txHash common.Hash) *types.Receipt\n```\n\n```go\nfunc SimulateIncomingHeads(t *testing.T, args SimulateIncomingHeadsArgs) (done chan struct{})\n```\nSimulateIncomingHeads spawns a goroutine which sends a stream of heads and closes the returned channel when finished.\n\n```go\nfunc TxReceiptFromFixture(t *testing.T, path string) *types.Receipt\n```\nTxReceiptFromFixture create ethtypes.log from file path\n\n```go\nfunc UnauthenticatedGet(t testing.TB, url string, headers map[string]string) (*http.Response, func())\n```\n\n```go\nfunc UnauthenticatedPost(t testing.TB, url string, body io.Reader, headers map[string]string) (*http.Response, func())\n```\n\n```go\nfunc WaitForCount(t *testing.T, db *sqlx.DB, tableName string, want int64)\n```\n\n```go\nfunc WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns int, expectedTaskRuns int, jo job.ORM, timeout, poll time.Duration, state pipeline.RunStatus) []pipeline.Run\n```\n\n```go\nfunc WaitForPipelineComplete(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns int, expectedTaskRuns int, jo job.ORM, timeout, poll time.Duration) []pipeline.Run\n```\n\n```go\nfunc WaitForPipelineError(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns int, expectedTaskRuns int, jo job.ORM, timeout, poll time.Duration) []pipeline.Run\n```\n\n```go\nfunc WaitForSpecErrorV2(t *testing.T, db *sqlx.DB, jobID int32, count int) []job.SpecError\n```\nWaitForSpecErrorV2 polls until the passed in jobID has count number of job spec errors.\n\n```go\nfunc WebURL(t testing.TB, unparsed string) models.WebURL\n```\nWebURL parses a url into a models.WebURL\n\n## Types\n\n```go\ntype Awaiter chan struct{}\n```\n\n```go\nfunc NewAwaiter() Awaiter\n```\n\n```go\nfunc (a Awaiter) AssertHappened(t *testing.T, expected bool)\n```\n\n```go\nfunc (a Awaiter) AwaitOrFail(t testing.TB, durationParams ...time.Duration)\n```\n\n```go\nfunc (a Awaiter) ItHappened()\n```\n\n```go\ntype BlockedRunner struct {\n\tDone chan struct{}\n}\n```\nBlockedRunner is a Runner that blocks until its channel is posted to\n\n```go\nfunc (r BlockedRunner) Run(context.Context, chainlink.Application) error\n```\nRun runs the blocked runner, doesn't return until the channel is signalled\n\n```go\ntype Blocks struct {\n\tHashes []common.Hash\n\n\tHeads map[int64]*evmtypes.Head\n\t// contains filtered or unexported fields\n}\n```\nBlocks - a helper logic to construct a range of linked heads and an ability to fork and create logs from them\n\n```go\nfunc NewBlocks(t *testing.T, numHashes int) *Blocks\n```\n\n```go\nfunc (b *Blocks) ForkAt(t *testing.T, blockNum int64, numHashes int) *Blocks\n```\n\n```go\nfunc (b *Blocks) HashesMap() map[int64]common.Hash\n```\n\n```go\nfunc (b *Blocks) Head(number uint64) *evmtypes.Head\n```\n\n```go\nfunc (b *Blocks) LogOnBlockNum(i uint64, addr common.Address) types.Log\n```\n\n```go\nfunc (b *Blocks) LogOnBlockNumRemoved(i uint64, addr common.Address) types.Log\n```\n\n```go\nfunc (b *Blocks) LogOnBlockNumWithIndex(i uint64, logIndex uint, addr common.Address) types.Log\n```\n\n```go\nfunc (b *Blocks) LogOnBlockNumWithIndexRemoved(i uint64, logIndex uint, addr common.Address) types.Log\n```\n\n```go\nfunc (b *Blocks) LogOnBlockNumWithTopics(i uint64, logIndex uint, addr common.Address, topics []common.Hash) types.Log\n```\n\n```go\nfunc (b *Blocks) NewHead(number uint64) *evmtypes.Head\n```\n\n```go\ntype BridgeOpts struct {\n\tName string\n\tURL  string\n}\n```\n\n```go\ntype EmptyRunner struct{}\n```\nEmptyRunner is an EmptyRunner\n\n```go\nfunc (r EmptyRunner) Run(context.Context, chainlink.Application) error\n```\nRun runs the empty runner\n\n```go\ntype EthereumLogIterator interface{ Next() bool }\n```\nEthereumLogIterator is the interface provided by gethwrapper representations of EVM logs.\n\n```go\ntype EventWebSocketServer struct {\n\t*httptest.Server\n\n\tConnected      chan struct{}\n\tDisconnected   chan struct{}\n\tReceivedText   chan string\n\tReceivedBinary chan []byte\n\tURL            *url.URL\n\t// contains filtered or unexported fields\n}\n```\nEventWebSocketServer is a web socket server designed specifically for testing\n\n```go\nfunc NewEventWebSocketServer(t *testing.T) (*EventWebSocketServer, func())\n```\nNewEventWebSocketServer returns a new EventWebSocketServer\n\n```go\nfunc (wss *EventWebSocketServer) Broadcast(message string) error\n```\nBroadcast sends a message to every web socket client connected to the EventWebSocketServer\n\n```go\nfunc (wss EventWebSocketServer) ConnectionsCount() int\n```\n\n```go\nfunc (wss *EventWebSocketServer) WriteCloseMessage()\n```\nWriteCloseMessage 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.\n\n```go\ntype ExternalInitiatorOpts struct {\n\tNamePrefix     string\n\tURL            *models.WebURL\n\tOutgoingSecret string\n\tOutgoingToken  string\n}\n```\n\n```go\ntype HTTPClientCleaner struct {\n\tHTTPClient cmd.HTTPClient\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r *HTTPClientCleaner) Delete(path string) (*http.Response, func())\n```\n\n```go\nfunc (r *HTTPClientCleaner) Get(path string, headers ...map[string]string) (*http.Response, func())\n```\n\n```go\nfunc (r *HTTPClientCleaner) Patch(path string, body io.Reader, headers ...map[string]string) (*http.Response, func())\n```\n\n```go\nfunc (r *HTTPClientCleaner) Post(path string, body io.Reader) (*http.Response, func())\n```\n\n```go\nfunc (r *HTTPClientCleaner) Put(path string, body io.Reader) (*http.Response, func())\n```\n\n```go\ntype HeadBuffer struct {\n\tHeads []*evmtypes.Head\n\t// contains filtered or unexported fields\n}\n```\nHeadBuffer - stores heads in sequence, with increasing timestamps\n\n```go\nfunc NewHeadBuffer(t *testing.T) *HeadBuffer\n```\n\n```go\nfunc (hb *HeadBuffer) Append(head *evmtypes.Head)\n```\n\n```go\ntype HeadTrackableFunc func(context.Context, *evmtypes.Head)\n```\n\n```go\nfunc (fn HeadTrackableFunc) OnNewLongestChain(ctx context.Context, head *evmtypes.Head)\n```\n\n```go\ntype InstanceAppFactory struct {\n\tApp chainlink.Application\n}\n```\nInstanceAppFactory is an InstanceAppFactory\n\n```go\nfunc (f InstanceAppFactory) NewApplication(context.Context, config.GeneralConfig, logger.Logger, *sqlx.DB) (chainlink.Application, error)\n```\nNewApplication creates a new application with specified config\n\n```go\ntype InstantClock struct{}\n```\nInstantClock an InstantClock\n\n```go\nfunc (InstantClock) After(_ time.Duration) \u003c-chan time.Time\n```\nAfter return channel of time\n\n```go\nfunc (InstantClock) Now() time.Time\n```\nNow returns the current local time\n\n```go\ntype JobPipelineV2TestHelper struct {\n\tPrm pipeline.ORM\n\tJrm job.ORM\n\tPr  pipeline.Runner\n}\n```\n\n```go\nfunc NewJobPipelineV2(t testing.TB, cfg config.BasicConfig, cc evm.ChainSet, db *sqlx.DB, keyStore keystore.Master, restrictedHTTPClient, unrestrictedHTTPClient *http.Client) JobPipelineV2TestHelper\n```\n\n```go\ntype MockAPIInitializer struct {\n\tCount int\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewMockAPIInitializer(t testing.TB) *MockAPIInitializer\n```\n\n```go\nfunc (m *MockAPIInitializer) Initialize(orm sessions.ORM, lggr logger.Logger) (sessions.User, error)\n```\n\n```go\ntype MockChangePasswordPrompter struct {\n\tweb.UpdatePasswordRequest\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (m MockChangePasswordPrompter) Prompt() (web.UpdatePasswordRequest, error)\n```\n\n```go\ntype MockCookieAuthenticator struct {\n\tSessionID string\n\tError     error\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (m MockCookieAuthenticator) Authenticate(sessions.SessionRequest) (*http.Cookie, error)\n```\n\n```go\nfunc (m MockCookieAuthenticator) Cookie() (*http.Cookie, error)\n```\n\n```go\nfunc (m MockCookieAuthenticator) Logout() error\n```\n\n```go\ntype MockCountingPrompter struct {\n\tT              *testing.T\n\tEnteredStrings []string\n\tCount          int\n\tNotTerminal    bool\n}\n```\nMockCountingPrompter is a mock counting prompt\n\n```go\nfunc (p *MockCountingPrompter) IsTerminal() bool\n```\nIsTerminal always returns true in tests\n\n```go\nfunc (p *MockCountingPrompter) PasswordPrompt(string) string\n```\nPasswordPrompt returns an entered string\n\n```go\nfunc (p *MockCountingPrompter) Prompt(string) string\n```\nPrompt returns an entered string\n\n```go\ntype MockCron struct {\n\tEntries []MockCronEntry\n\t// contains filtered or unexported fields\n}\n```\nMockCron represents a mock cron\n\n```go\nfunc (mc *MockCron) AddFunc(schd string, fn func()) (cron.EntryID, error)\n```\nAddFunc appends a schedule to mockcron entries\n\n```go\nfunc (mc *MockCron) RunEntries()\n```\nRunEntries run every function for each mockcron entry\n\n```go\nfunc (*MockCron) Start()\n```\nStart starts the mockcron\n\n```go\nfunc (*MockCron) Stop() context.Context\n```\nStop stops the mockcron\n\n```go\ntype MockCronEntry struct {\n\tSchedule string\n\tFunction func()\n}\n```\nMockCronEntry a cron schedule and function\n\n```go\ntype MockHeadTrackable struct {\n\t// contains filtered or unexported fields\n}\n```\nMockHeadTrackable allows you to mock HeadTrackable\n\n```go\nfunc (m *MockHeadTrackable) OnNewLongestChain(context.Context, *evmtypes.Head)\n```\nOnNewLongestChain increases the OnNewLongestChainCount count by one\n\n```go\nfunc (m *MockHeadTrackable) OnNewLongestChainCount() int32\n```\nOnNewLongestChainCount returns the count of new heads, safely.\n\n```go\ntype MockPasswordPrompter struct {\n\tPassword string\n}\n```\n\n```go\nfunc (m MockPasswordPrompter) Prompt() string\n```\n\n```go\ntype MockSecretGenerator struct{}\n```\n\n```go\nfunc (m MockSecretGenerator) Generate(string) ([]byte, error)\n```\n\n```go\ntype MockSessionRequestBuilder struct {\n\tCount int\n\tError error\n}\n```\n\n```go\nfunc (m *MockSessionRequestBuilder) Build(string) (sessions.SessionRequest, error)\n```\n\n```go\ntype MockSubscription struct {\n\tErrors chan error\n\t// contains filtered or unexported fields\n}\n```\nMockSubscription a mock subscription\n\n```go\nfunc EmptyMockSubscription(t testing.TB) *MockSubscription\n```\nEmptyMockSubscription return empty MockSubscription\n\n```go\nfunc (mes *MockSubscription) Err() \u003c-chan error\n```\nErr returns error channel from mes\n\n```go\nfunc (mes *MockSubscription) Unsubscribe()\n```\nUnsubscribe closes the subscription\n\n```go\ntype NeverSleeper struct{}\n```\nNeverSleeper is a struct that never sleeps\n\n```go\nfunc (ns NeverSleeper) After() time.Duration\n```\nAfter returns a duration\n\n```go\nfunc (ns NeverSleeper) Duration() time.Duration\n```\nDuration returns a duration\n\n```go\nfunc (ns NeverSleeper) Reset()\n```\nReset resets the never sleeper\n\n```go\nfunc (ns NeverSleeper) Sleep()\n```\nSleep puts the never sleeper to sleep\n\n```go\ntype RendererMock struct {\n\tRenders []interface{}\n}\n```\nRendererMock a mock renderer\n\n```go\nfunc (rm *RendererMock) Render(v interface{}, headers ...string) error\n```\nRender appends values to renderer mock\n\n```go\ntype SimulateIncomingHeadsArgs struct {\n\tStartBlock, EndBlock int64\n\tHeadTrackables       []httypes.HeadTrackable\n\tBlocks               *Blocks\n}\n```\n\n```go\ntype TestApplication struct {\n\t*chainlink.ChainlinkApplication\n\tLogger  logger.Logger\n\tServer  *httptest.Server\n\tStarted bool\n\tBackend *backends.SimulatedBackend\n\tKeys    []ethkey.KeyV2\n\t// contains filtered or unexported fields\n}\n```\nTestApplication holds the test application and test servers\n\n```go\nfunc NewApplication(t testing.TB, flagsAndDeps ...interface{}) *TestApplication\n```\nNewApplication creates a New TestApplication along with a NewConfig It mocks the keystore with no keys or accounts by default\n\n```go\nfunc NewApplicationEVMDisabled(t *testing.T) *TestApplication\n```\nNewApplicationEVMDisabled creates a new application with default config but EVM disabled Useful for testing controllers\n\n```go\nfunc NewApplicationWithConfig(t testing.TB, cfg config.GeneralConfig, flagsAndDeps ...interface{}) *TestApplication\n```\nNewApplicationWithConfig creates a New TestApplication with specified test config. This should only be used in full integration tests. For controller tests, see NewApplicationEVMDisabled.\n\n```go\nfunc NewApplicationWithConfigAndKey(t testing.TB, c config.GeneralConfig, flagsAndDeps ...interface{}) *TestApplication\n```\nNewApplicationWithConfigAndKey creates a new TestApplication with the given testorm it will also provide an unlocked account on the keystore\n\n```go\nfunc NewApplicationWithConfigV2AndKeyOnSimulatedBlockchain(\n\tt testing.TB,\n\tcfg coreconfig.GeneralConfig,\n\tbackend *backends.SimulatedBackend,\n\tflagsAndDeps ...interface{},\n) *TestApplication\n```\nNewApplicationWithConfigV2AndKeyOnSimulatedBlockchain is like NewApplicationWithConfigAndKeyOnSimulatedBlockchain but cfg should be v2, and configtest.NewGeneralConfigSimulated used to include the simulated chain (testutils.SimulatedChainID).\n\n```go\nfunc NewApplicationWithKey(t *testing.T, flagsAndDeps ...interface{}) *TestApplication\n```\nNewApplicationWithKey creates a new TestApplication along with a new config It uses the native keystore and will load any keys that are in the database\n\n```go\nfunc NewLegacyApplicationEVMDisabled(t *testing.T) *TestApplication\n```\nDeprecated: use NewApplicationEVMDisabled [https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config](https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config)\n\n```go\nfunc (ta *TestApplication) Import(content string)\n```\nImportKey adds private key to the application keystore and database\n\n```go\nfunc (ta *TestApplication) MustSeedNewSession(roleFixtureUserAPIEmail string) (id string)\n```\n\n```go\nfunc (ta *TestApplication) NewAuthenticatingClient(prompter cmd.Prompter) *cmd.Client\n```\n\n```go\nfunc (ta *TestApplication) NewClientAndRenderer() (*cmd.Client, *RendererMock)\n```\nNewClientAndRenderer creates a new cmd.Client for the test application\n\n```go\nfunc (ta *TestApplication) NewClientOpts() cmd.ClientOpts\n```\n\n```go\nfunc (ta *TestApplication) NewHTTPClient(roleFixtureUserAPIEmail string) HTTPClientCleaner\n```\n\n```go\nfunc (ta *TestApplication) Start(ctx context.Context) error\n```\nStart starts the chainlink app and registers Stop to clean up at end of test.\n\n```go\nfunc (ta *TestApplication) Stop() error\n```\nStop will stop the test application and perform cleanup\n\n```go\ntype TransactionReceipter interface {\n\tTransactionReceipt(context.Context, common.Hash) (*types.Receipt, error)\n}\n```\n\n","path":"github.com/GoPlugin/pluginV2/core/internal/cltest","name":"cltest","synopsis":"Importing cltest should only be for top level black box (X_test package) integration tests, for example testing against the Application object itself.","isRedistributable":true}
