cltest

package
v0.0.0-...-537fcec Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const Password = "password"
View Source
const RootDir = "/tmp/chainlink_test"
View Source
const Username = "testusername"

Variables

This section is empty.

Functions

func AddPrivateKey

func AddPrivateKey(config *TestConfig, src string)

func BasicAuthGet

func BasicAuthGet(url string) *http.Response

func BasicAuthPatch

func BasicAuthPatch(url string, contentType string, body io.Reader) *http.Response

func BasicAuthPost

func BasicAuthPost(url string, contentType string, body io.Reader) *http.Response

func BigHexInt

func BigHexInt(val interface{}) hexutil.Big

func CheckStatusCode

func CheckStatusCode(t *testing.T, resp *http.Response, expected int)

func CloseGock

func CloseGock(t *testing.T)

func CreateBridgeTypeViaWeb

func CreateBridgeTypeViaWeb(
	t *testing.T,
	app *TestApplication,
	payload string,
) models.BridgeType

func CreateJobRunViaWeb

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

func CreateTxAndAttempt

func CreateTxAndAttempt(
	store *store.Store,
	from common.Address,
	sentAt uint64,
) *models.Tx

func FixtureCreateJobViaWeb

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

func IndexableBlockNumber

func IndexableBlockNumber(n int64) *models.IndexableBlockNumber

func JSONFromFixture

func JSONFromFixture(path string) models.JSON

func JSONFromString

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

func JSONResultFromFixture

func JSONResultFromFixture(path string) models.JSON

func LoadJSON

func LoadJSON(file string) []byte

func LogFromFixture

func LogFromFixture(path string) ethtypes.Log

func MarkJobRunPending

func MarkJobRunPending(jr models.JobRun, i int) models.JobRun

func MustParseWebURL

func MustParseWebURL(str string) models.WebURL

func NewAddress

func NewAddress() common.Address

func NewBridgeType

func NewBridgeType(info ...string) models.BridgeType

func NewEthereumListener

func NewEthereumListener() (*services.EthereumListener, func())

func NewHTTPMockServer

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

func NewHash

func NewHash() common.Hash

func NewJob

func NewJob() models.JobSpec

func NewJobWithLogInitiator

func NewJobWithLogInitiator() models.JobSpec

func NewJobWithSchedule

func NewJobWithSchedule(sched string) models.JobSpec

func NewJobWithWebInitiator

func NewJobWithWebInitiator() models.JobSpec

func NewRunLog

func NewRunLog(jobID string, addr common.Address, json string) ethtypes.Log

func NewStore

func NewStore() (*store.Store, func())

func NewStoreWithConfig

func NewStoreWithConfig(config *TestConfig) (*store.Store, func())

func NewTask

func NewTask(taskType string, json ...string) models.TaskSpec

func NewTx

func NewTx(from common.Address, sentAt uint64) *models.Tx

func NewWSServer

func NewWSServer(msg string) *httptest.Server

func NullString

func NullString(val interface{}) null.String

func NullTime

func NullTime(val interface{}) null.Time

func NullableTime

func NullableTime(t time.Time) null.Time

func ObserveLogs

func ObserveLogs() *observer.ObservedLogs

func ParseISO8601

func ParseISO8601(s string) time.Time

func ParseNullableTime

func ParseNullableTime(s string) null.Time

func ParseResponseBody

func ParseResponseBody(resp *http.Response) []byte

func RunResultWithError

func RunResultWithError(err error) models.RunResult

func RunResultWithValue

func RunResultWithValue(val string) models.RunResult

func StringToRunLogData

func StringToRunLogData(str string) hexutil.Bytes

func UpdateJobRunViaWeb

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

func WaitForJobRunStatus

func WaitForJobRunStatus(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
	status string,
) models.JobRun

func WaitForJobRunToComplete

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

func WaitForJobRunToPend

func WaitForJobRunToPend(
	t *testing.T,
	store *store.Store,
	jr models.JobRun,
) models.JobRun

func WaitForRuns

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

func WebURL

func WebURL(unparsed string) models.WebURL

Types

type CallbackAuthenticator

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

func (CallbackAuthenticator) Authenticate

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

type CommonJSON

type CommonJSON struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func ParseCommonJSON

func ParseCommonJSON(body io.Reader) CommonJSON

type EmptyAppFactory

type EmptyAppFactory struct{}

func (EmptyAppFactory) NewApplication

func (f EmptyAppFactory) NewApplication(config store.Config) services.Application

type EmptyApplication

type EmptyApplication struct{}

func (*EmptyApplication) GetStore

func (a *EmptyApplication) GetStore() *store.Store

func (*EmptyApplication) Start

func (a *EmptyApplication) Start() error

func (*EmptyApplication) Stop

func (a *EmptyApplication) Stop() error

type EmptyRunner

type EmptyRunner struct{}

func (EmptyRunner) Run

type EthMock

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

func MockEthOnStore

func MockEthOnStore(s *store.Store) *EthMock

func (*EthMock) AllCalled

func (mock *EthMock) AllCalled() bool

func (*EthMock) Call

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

func (*EthMock) EnsureAllCalled

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

func (*EthMock) EthSubscribe

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

func (*EthMock) Register

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

func (*EthMock) RegisterError

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

func (*EthMock) RegisterNewHead

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

func (*EthMock) RegisterNewHeads

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

func (*EthMock) RegisterSubscription

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

type InstanceAppFactory

type InstanceAppFactory struct {
	App services.Application
}

func (InstanceAppFactory) NewApplication

func (f InstanceAppFactory) NewApplication(config store.Config) services.Application

type InstantClock

type InstantClock struct{}

func (InstantClock) After

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

func (InstantClock) Now

func (InstantClock) Now() time.Time

type MockCountingPrompt

type MockCountingPrompt struct {
	EnteredStrings []string
	Count          int
}

func (*MockCountingPrompt) Prompt

func (p *MockCountingPrompt) Prompt(string) string

type MockCron

type MockCron struct {
	Entries []MockCronEntry
}

func NewMockCron

func NewMockCron() *MockCron

func (*MockCron) AddFunc

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

func (*MockCron) RunEntries

func (mc *MockCron) RunEntries()

func (*MockCron) Start

func (*MockCron) Start()

func (*MockCron) Stop

func (*MockCron) Stop()

type MockCronEntry

type MockCronEntry struct {
	Schedule string
	Function func()
}

type MockHeadTrackable

type MockHeadTrackable struct {
	ConnectedCount    int
	DisconnectedCount int
	OnNewHeadCount    int
}

func (*MockHeadTrackable) Connect

func (m *MockHeadTrackable) Connect() error

func (*MockHeadTrackable) Disconnect

func (m *MockHeadTrackable) Disconnect()

func (*MockHeadTrackable) OnNewHead

func (m *MockHeadTrackable) OnNewHead(*models.BlockHeader)

type MockResponse

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

type MockSubscription

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

func EmptyMockSubscription

func EmptyMockSubscription() MockSubscription

func (MockSubscription) Err

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

func (MockSubscription) Unsubscribe

func (mes MockSubscription) Unsubscribe()

type NeverClock

type NeverClock struct{}

func (NeverClock) After

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

func (NeverClock) Now

func (NeverClock) Now() time.Time

type NeverSleeper

type NeverSleeper struct{}

func (NeverSleeper) Duration

func (ns NeverSleeper) Duration() time.Duration

func (NeverSleeper) Reset

func (ns NeverSleeper) Reset()

func (NeverSleeper) Sleep

func (ns NeverSleeper) Sleep()

type RendererMock

type RendererMock struct {
	Renders []interface{}
}

func NewClientAndRenderer

func NewClientAndRenderer(config store.Config) (*cmd.Client, *RendererMock)

func (*RendererMock) Render

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

type SettableClock

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

func UseSettableClock

func UseSettableClock(s *store.Store) *SettableClock

func (*SettableClock) After

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

func (*SettableClock) Now

func (clock *SettableClock) Now() time.Time

func (*SettableClock) SetTime

func (clock *SettableClock) SetTime(t time.Time)

type TestApplication

type TestApplication struct {
	*services.ChainlinkApplication
	Server *httptest.Server
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication() (*TestApplication, func())

func NewApplicationWithConfig

func NewApplicationWithConfig(tc *TestConfig) (*TestApplication, func())

func NewApplicationWithKeyStore

func NewApplicationWithKeyStore() (*TestApplication, func())

func (*TestApplication) InstantClock

func (ta *TestApplication) InstantClock() InstantClock

func (*TestApplication) MockEthClient

func (ta *TestApplication) MockEthClient() *EthMock

func (*TestApplication) Stop

func (ta *TestApplication) Stop() error

type TestConfig

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

func NewConfig

func NewConfig() (*TestConfig, func())

func NewConfigWithWSServer

func NewConfigWithWSServer(wsserver *httptest.Server) *TestConfig

func (*TestConfig) SetEthereumServer

func (tc *TestConfig) SetEthereumServer(wss *httptest.Server)

Jump to

Keyboard shortcuts

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