Skip to main content

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

Class: default

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

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​

Constructor​

new default(job, options?): WorkerTestHarness

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

Parameters​

ParameterType
jobJobConfigParams
optionsJobHarnessOptions

Returns​

WorkerTestHarness

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:84

Returns​

JobAPIInstances


processors​

Get Signature​

get processors(): ProcessorCore<OpConfig>[]

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

Returns​

ProcessorCore<OpConfig>[]

Methods​

fetcher()​

fetcher<T>(): T

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

Type Parameters​

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

Returns​

T


flush()​

Call Signature​

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

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

Shutdown the Operations on the ExecutionContext

Returns​

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

Call Signature​

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

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

Shutdown the Operations on the ExecutionContext

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

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

Call Signature​

flush(options): Promise<RunSliceResult | undefined>

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

Shutdown the Operations on the ExecutionContext

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

Promise<RunSliceResult | undefined>


getAPI()​

getAPI<T>(name): T

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

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:99

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:107

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:117

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:135

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:138

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:142

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:91

Cleanup test code

Returns​

Promise<void>

Inherited from​

default.shutdown


testFetcher()​

static testFetcher(opConfig, apiConfig, options?): WorkerTestHarness

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

Parameters​

ParameterType
opConfigOpConfig
apiConfigAPIConfig
options?JobHarnessOptions

Returns​

WorkerTestHarness


testProcessor()​

static testProcessor(opConfig, options?): WorkerTestHarness

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

Parameters​

ParameterType
opConfigOpConfig
options?JobHarnessOptions

Returns​

WorkerTestHarness


testSender()​

static testSender(opConfig, apiConfig, options?): WorkerTestHarness

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

Parameters​

ParameterType
opConfigOpConfig
apiConfigAPIConfig
options?JobHarnessOptions

Returns​

WorkerTestHarness