Skip to main content

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

Class: default

Defined in: teraslice-test-harness/src/worker-test-harness.ts:27

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

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

Parameters

ParameterType
jobJobConfigParams
optionsJobHarnessOptions

Returns

default

Overrides

default.constructor

Properties

PropertyModifierTypeInherited fromDefined in
assetPathsreadonlystring[]default.assetPathsteraslice-test-harness/src/base-test-harness.ts:24
clusterType?readonlyClusterManagerTypedefault.clusterTypeteraslice-test-harness/src/base-test-harness.ts:25
contextreadonlyTestContextdefault.contextteraslice-test-harness/src/base-test-harness.ts:22
eventsreadonlyEventEmitterdefault.eventsteraslice-test-harness/src/base-test-harness.ts:20
executionContextpublicWorkerExecutionContextdefault.executionContextteraslice-test-harness/src/base-test-harness.ts:21
jobreadonlyJobConfigParamsdefault.jobteraslice-test-harness/src/base-test-harness.ts:23

Accessors

apis

Get Signature

get apis(): JobAPIInstances

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

Returns

JobAPIInstances


processors

Get Signature

get processors(): ProcessorCore<OpConfig>[]

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

Returns

ProcessorCore<OpConfig>[]

Methods

fetcher()

fetcher<T>(): T

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

Type Parameters

Type ParameterDefault type
T extends FetcherCore<OpConfig>FetcherCore<OpConfig>

Returns

T


flush()

Call Signature

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

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

Shutdown the Operations on the ExecutionContext

Returns

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

Call Signature

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

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

Shutdown the Operations on the ExecutionContext

Parameters
ParameterType
options{ fullResponse: false; }
options.fullResponsefalse
Returns

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

Call Signature

flush(options): Promise<undefined | RunSliceResult>

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

Shutdown the Operations on the ExecutionContext

Parameters
ParameterType
options{ fullResponse: true; }
options.fullResponsetrue
Returns

Promise<undefined | RunSliceResult>


getAPI()

getAPI<T>(name): T

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

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 ParameterDefault type
T extends OpAPIany

Parameters

ParameterType
namestring

Returns

T


getOperation()

getOperation<T>(findBy): T

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

Get the instantiated Operation class instance from the operations list

Type Parameters

Type ParameterDefault type
T extends OperationCore<OpConfig>OperationCore<OpConfig>

Parameters

ParameterType
findBystring | number

Returns

T


getOperationAPI()

getOperationAPI<T>(name): T

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

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 ParameterDefault type
T extends APICore<APIConfig>APICore<APIConfig>

Parameters

ParameterType
namestring

Returns

T


initialize()

initialize(): Promise<void>

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

Initialize the Operations on the ExecutionContext

Returns

Promise<void>

Overrides

default.initialize


makeContextConfig()

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

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

Parameters

ParameterTypeDefault value
jobJobConfigParamsundefined
assetsstring[]...
cluster_manager_typeClusterManagerType'native'

Returns

Promise<ExecutionContextConfig>

Inherited from

default.makeContextConfig


runSlice()

Call Signature

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

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

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

Call Signature

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

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

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.
options{ fullResponse: false; }an optional object of additional configruation
options.fullResponsefalseif specified it will return an object with both the slice results and any analytics if specified on the Job.
Returns

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

an Array of DataEntities or a SliceResult

Call Signature

runSlice(input, options): Promise<RunSliceResult>

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

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.
options{ fullResponse: true; }an optional object of additional configruation
options.fullResponsetrueif specified it will return an object with both the slice results and any analytics if specified on the Job.
Returns

Promise<RunSliceResult>

an Array of DataEntities or a SliceResult


setClients()

setClients(clients): void

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

Parameters

ParameterType
clientsTestClientConfig[]

Returns

void

Inherited from

default.setClients


shutdown()

shutdown(): Promise<void>

Defined in: teraslice-test-harness/src/base-test-harness.ts:90

Cleanup test code

Returns

Promise<void>

Inherited from

default.shutdown


testFetcher()

static testFetcher(opConfig, options?): default

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

Parameters

ParameterType
opConfigOpConfig
options?JobHarnessOptions

Returns

default


testProcessor()

static testProcessor(opConfig, options?): default

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

Parameters

ParameterType
opConfigOpConfig
options?JobHarnessOptions

Returns

default