Skip to main content

teraslice-test-harness / worker-test-harness / default

Class: default

A test harness for testing Operations that run on Workers, mainly Fetchers and Processors.

This is useful for testing Fetcher and Processors together or individually.

Todo

Add support for attaching APIs and Observers

Extends

Constructors

new default()

new default(job, options): default

Parameters

ParameterType
jobJobConfigParams
optionsJobHarnessOptions

Returns

default

Overrides

default.constructor

Source

teraslice-test-harness/src/worker-test-harness.ts:28

Properties

assetPaths

readonly assetPaths: string[]

Inherited from

default.assetPaths

Source

teraslice-test-harness/src/base-test-harness.ts:24


clusterType?

optional readonly clusterType: ClusterManagerType

Inherited from

default.clusterType

Source

teraslice-test-harness/src/base-test-harness.ts:25


context

readonly context: TestContext

Inherited from

default.context

Source

teraslice-test-harness/src/base-test-harness.ts:22


events

readonly events: EventEmitter<DefaultEventMap>

Inherited from

default.events

Source

teraslice-test-harness/src/base-test-harness.ts:20


executionContext

executionContext: WorkerExecutionContext

Inherited from

default.executionContext

Source

teraslice-test-harness/src/base-test-harness.ts:21


job

readonly job: JobConfigParams

Inherited from

default.job

Source

teraslice-test-harness/src/base-test-harness.ts:23

Accessors

apis

get apis(): JobAPIInstances

Returns

JobAPIInstances

Source

teraslice-test-harness/src/worker-test-harness.ts:67


processors

get processors(): default<OpConfig>[]

Returns

default<OpConfig>[]

Source

teraslice-test-harness/src/worker-test-harness.ts:63

Methods

fetcher()

fetcher<T>(): T

Type parameters

Type parameterValue
T extends default<OpConfig>default<OpConfig>

Returns

T

Source

teraslice-test-harness/src/worker-test-harness.ts:59


flush()

flush()

flush(): Promise<undefined | DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Shutdown the Operations on the ExecutionContext

Returns

Promise<undefined | DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Source

teraslice-test-harness/src/worker-test-harness.ts:162

flush(options)

flush(options): Promise<undefined | DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Parameters
ParameterType
optionsobject
options.fullResponsefalse
Returns

Promise<undefined | DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Source

teraslice-test-harness/src/worker-test-harness.ts:163

flush(options)

flush(options): Promise<undefined | RunSliceResult>

Parameters
ParameterType
optionsobject
options.fullResponsetrue
Returns

Promise<undefined | RunSliceResult>

Source

teraslice-test-harness/src/worker-test-harness.ts:164


getAPI()

getAPI<T>(name): T

Get the reference to a created API that a operation will use. This is different than getOperationAPI which the OperationAPI class instance

Type parameters

Type parameterValue
T extends OpAPIany

Parameters

ParameterType
namestring

Returns

T

Source

teraslice-test-harness/src/worker-test-harness.ts:75


getOperation()

getOperation<T>(findBy): T

Get the instantiated Operation class instance from the operations list

Type parameters

Type parameterValue
T extends default<OpConfig>default<OpConfig>

Parameters

ParameterType
findBystring | number

Returns

T

Source

teraslice-test-harness/src/worker-test-harness.ts:82


getOperationAPI()

getOperationAPI<T>(name): T

Get the instantiated OperationAPI class instance from the apis. If you are looking for the APIs that created during run time, use getAPI.

Type parameters

Type parameterValue
T extends default<APIConfig>default<APIConfig>

Parameters

ParameterType
namestring

Returns

T

Source

teraslice-test-harness/src/worker-test-harness.ts:90


initialize()

initialize(): Promise<void>

Initialize the Operations on the ExecutionContext

Returns

Promise<void>

Overrides

default.initialize

Source

teraslice-test-harness/src/worker-test-harness.ts:100


makeContextConfig()

protected makeContextConfig(job, assets, cluster_manager_type): Promise<ExecutionContextConfig>

Parameters

ParameterTypeDefault value
jobJobConfigParamsundefined
assetsstring[]undefined
cluster_manager_typeClusterManagerType'native'

Returns

Promise<ExecutionContextConfig>

Inherited from

default.makeContextConfig

Source

teraslice-test-harness/src/base-test-harness.ts:53


runSlice()

runSlice(input)

runSlice(input): Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Given a slice run pass it the Fetcher and then subsequent operations. This will also fire lifecycle events which may be triggered any extra APIs.

Parameters
ParameterTypeDescription
inputSlice | SliceRequestThe input slice, can optionally include all of the slice metadata. Use newTestSlice() to create a test slice.
Returns

Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

an Array of DataEntities or a SliceResult

Source

teraslice-test-harness/src/worker-test-harness.ts:118

runSlice(input, options)

runSlice(input, options): Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Parameters
ParameterType
inputSlice | SliceRequest
optionsobject
options.fullResponsefalse
Returns

Promise<DataEntity<Record<string, any>, _DataEntityMetadata<Record<string, any>>>[]>

Source

teraslice-test-harness/src/worker-test-harness.ts:121

runSlice(input, options)

runSlice(input, options): Promise<RunSliceResult>

Parameters
ParameterType
inputSlice | SliceRequest
optionsobject
options.fullResponsetrue
Returns

Promise<RunSliceResult>

Source

teraslice-test-harness/src/worker-test-harness.ts:125


setClients()

setClients(clients): void

Parameters

ParameterType
clientsTestClientConfig[]

Returns

void

Inherited from

default.setClients

Source

teraslice-test-harness/src/base-test-harness.ts:49


shutdown()

shutdown(): Promise<void>

Cleanup test code

Returns

Promise<void>

Inherited from

default.shutdown

Source

teraslice-test-harness/src/base-test-harness.ts:83


testFetcher()

static testFetcher(opConfig, options?): default

Parameters

ParameterType
opConfigOpConfig
options?JobHarnessOptions

Returns

default

Source

teraslice-test-harness/src/worker-test-harness.ts:46


testProcessor()

static testProcessor(opConfig, options?): default

Parameters

ParameterType
opConfigOpConfig
options?JobHarnessOptions

Returns

default

Source

teraslice-test-harness/src/worker-test-harness.ts:32