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
default
<WorkerExecutionContext
>
Constructors
new default()
new default(
job
,options
):default
Parameters
Parameter | Type |
---|---|
job | JobConfigParams |
options | JobHarnessOptions |
Returns
Overrides
Source
teraslice-test-harness/src/worker-test-harness.ts:28
Properties
assetPaths
readonly
assetPaths:string
[]
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:24
clusterType?
optional
readonly
clusterType:ClusterManagerType
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:25
context
readonly
context:TestContext
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:22
events
readonly
events:EventEmitter
<DefaultEventMap
>
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:20
executionContext
executionContext:
WorkerExecutionContext
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:21
job
readonly
job:JobConfigParams
Inherited from
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 parameter | Value |
---|---|
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
Parameter | Type |
---|---|
options | object |
options.fullResponse | false |
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
Parameter | Type |
---|---|
options | object |
options.fullResponse | true |
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 parameter | Value |
---|---|
T extends OpAPI | any |
Parameters
Parameter | Type |
---|---|
name | string |
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 parameter | Value |
---|---|
T extends default <OpConfig > | default <OpConfig > |
Parameters
Parameter | Type |
---|---|
findBy | string | 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 parameter | Value |
---|---|
T extends default <APIConfig > | default <APIConfig > |
Parameters
Parameter | Type |
---|---|
name | string |
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
Source
teraslice-test-harness/src/worker-test-harness.ts:100
makeContextConfig()
protected
makeContextConfig(job
,assets
,cluster_manager_type
):Promise
<ExecutionContextConfig
>
Parameters
Parameter | Type | Default value |
---|---|---|
job | JobConfigParams | undefined |
assets | string [] | undefined |
cluster_manager_type | ClusterManagerType | 'native' |
Returns
Promise
<ExecutionContextConfig
>
Inherited from
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
Parameter | Type | Description |
---|---|---|
input | Slice | SliceRequest | The 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
Parameter | Type |
---|---|
input | Slice | SliceRequest |
options | object |
options.fullResponse | false |
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
Parameter | Type |
---|---|
input | Slice | SliceRequest |
options | object |
options.fullResponse | true |
Returns
Promise
<RunSliceResult
>
Source
teraslice-test-harness/src/worker-test-harness.ts:125
setClients()
setClients(
clients
):void
Parameters
Parameter | Type |
---|---|
clients | TestClientConfig [] |
Returns
void
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:49
shutdown()
shutdown():
Promise
<void
>
Cleanup test code
Returns
Promise
<void
>
Inherited from
Source
teraslice-test-harness/src/base-test-harness.ts:83
testFetcher()
static
testFetcher(opConfig
,options
?):default
Parameters
Parameter | Type |
---|---|
opConfig | OpConfig |
options ? | JobHarnessOptions |
Returns
Source
teraslice-test-harness/src/worker-test-harness.ts:46
testProcessor()
static
testProcessor(opConfig
,options
?):default
Parameters
Parameter | Type |
---|---|
opConfig | OpConfig |
options ? | JobHarnessOptions |