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
default
<WorkerExecutionContext
>
Constructors
new default()
new default(
job
,options
):default
Defined in: teraslice-test-harness/src/worker-test-harness.ts:28
Parameters
Parameter | Type |
---|---|
job | JobConfigParams |
options | JobHarnessOptions |
Returns
Overrides
Properties
Property | Modifier | Type | Inherited from | Defined in |
---|---|---|---|---|
assetPaths | readonly | string [] | default .assetPaths | teraslice-test-harness/src/base-test-harness.ts:24 |
clusterType? | readonly | ClusterManagerType | default .clusterType | teraslice-test-harness/src/base-test-harness.ts:25 |
context | readonly | TestContext | default .context | teraslice-test-harness/src/base-test-harness.ts:22 |
events | readonly | EventEmitter | default .events | teraslice-test-harness/src/base-test-harness.ts:20 |
executionContext | public | WorkerExecutionContext | default .executionContext | teraslice-test-harness/src/base-test-harness.ts:21 |
job | readonly | JobConfigParams | default .job | teraslice-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 Parameter | Default 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
Parameter | Type |
---|---|
options | { fullResponse : false ; } |
options.fullResponse | false |
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
Parameter | Type |
---|---|
options | { fullResponse : true ; } |
options.fullResponse | true |
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 Parameter | Default type |
---|---|
T extends OpAPI | any |
Parameters
Parameter | Type |
---|---|
name | string |
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 Parameter | Default type |
---|---|
T extends OperationCore <OpConfig > | OperationCore <OpConfig > |
Parameters
Parameter | Type |
---|---|
findBy | string | 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 Parameter | Default type |
---|---|
T extends APICore <APIConfig > | APICore <APIConfig > |
Parameters
Parameter | Type |
---|---|
name | string |
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
makeContextConfig()
protected
makeContextConfig(job
,assets
,cluster_manager_type
):Promise
<ExecutionContextConfig
>
Defined in: teraslice-test-harness/src/base-test-harness.ts:53
Parameters
Parameter | Type | Default value |
---|---|---|
job | JobConfigParams | undefined |
assets | string [] | ... |
cluster_manager_type | ClusterManagerType | 'native' |
Returns
Promise
<ExecutionContextConfig
>
Inherited from
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
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
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
Parameter | Type | Description |
---|---|---|
input | Slice | SliceRequest | The 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.fullResponse | false | if 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
Parameter | Type | Description |
---|---|---|
input | Slice | SliceRequest | The 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.fullResponse | true | if 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
Parameter | Type |
---|---|
clients | TestClientConfig [] |
Returns
void
Inherited from
shutdown()
shutdown():
Promise
<void
>
Defined in: teraslice-test-harness/src/base-test-harness.ts:90
Cleanup test code
Returns
Promise
<void
>
Inherited from
testFetcher()
static
testFetcher(opConfig
,options
?):default
Defined in: teraslice-test-harness/src/worker-test-harness.ts:46
Parameters
Parameter | Type |
---|---|
opConfig | OpConfig |
options ? | JobHarnessOptions |
Returns
testProcessor()
static
testProcessor(opConfig
,options
?):default
Defined in: teraslice-test-harness/src/worker-test-harness.ts:32
Parameters
Parameter | Type |
---|---|
opConfig | OpConfig |
options ? | JobHarnessOptions |