Teraslice Test Harness: `Worker Test Harness Default`
worker-test-harness.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
Hierarchy
default
<WorkerExecutionContext
>↳
default
Table of contents
Constructors
Properties
Accessors
Methods
- fetcher
- flush
- getAPI
- getOperation
- getOperationAPI
- initialize
- makeContextConfig
- runSlice
- setClients
- shutdown
- testFetcher
- testProcessor
Constructors
constructor
• new default(job
, options?
): default
Parameters
Name | Type |
---|---|
job | Partial <ValidatedJobConfig > |
options | JobHarnessOptions |
Returns
Overrides
Defined in
teraslice-test-harness/src/worker-test-harness.ts:28
Properties
context
• Readonly
context: TestContext
Inherited from
Defined in
teraslice-test-harness/src/base-test-harness.ts:22
events
• Readonly
events: EventEmitter
Inherited from
Defined in
teraslice-test-harness/src/base-test-harness.ts:20
executionContext
• Readonly
executionContext: WorkerExecutionContext
Inherited from
Defined in
teraslice-test-harness/src/base-test-harness.ts:21
Accessors
apis
• get
apis(): JobAPIInstances
Returns
JobAPIInstances
Defined in
teraslice-test-harness/src/worker-test-harness.ts:67
processors
• get
processors(): default
<OpConfig
>[]
Returns
default
<OpConfig
>[]
Defined in
teraslice-test-harness/src/worker-test-harness.ts:63
Methods
fetcher
▸ fetcher<T
>(): T
Type parameters
Name | Type |
---|---|
T | extends default <OpConfig > = default <OpConfig > |
Returns
T
Defined in
teraslice-test-harness/src/worker-test-harness.ts:59
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
>>>[]>
Defined in
teraslice-test-harness/src/worker-test-harness.ts:162
▸ flush(options
): Promise
<undefined
| DataEntity
<Record
<string
, any
>, _DataEntityMetadata
<Record
<string
, any
>>>[]>
Parameters
Name | Type |
---|---|
options | Object |
options.fullResponse | false |
Returns
Promise
<undefined
| DataEntity
<Record
<string
, any
>, _DataEntityMetadata
<Record
<string
, any
>>>[]>
Defined in
teraslice-test-harness/src/worker-test-harness.ts:163
▸ flush(options
): Promise
<undefined
| RunSliceResult
>
Parameters
Name | Type |
---|---|
options | Object |
options.fullResponse | true |
Returns
Promise
<undefined
| RunSliceResult
>
Defined in
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
Name | Type |
---|---|
T | extends OpAPI = any |
Parameters
Name | Type |
---|---|
name | string |
Returns
T
Defined in
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
Name | Type |
---|---|
T | extends default <OpConfig > = default <OpConfig > |
Parameters
Name | Type | |
---|---|---|
findBy | string \ | number |
Returns
T
Defined in
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
Name | Type |
---|---|
T | extends default <APIConfig > = default <APIConfig > |
Parameters
Name | Type |
---|---|
name | string |
Returns
T
Defined in
teraslice-test-harness/src/worker-test-harness.ts:90
initialize
▸ initialize(): Promise
<void
>
Initialize the Operations on the ExecutionContext
Returns
Promise
<void
>
Overrides
Defined in
teraslice-test-harness/src/worker-test-harness.ts:100
makeContextConfig
▸ makeContextConfig(job
, assets?
, cluster_manager_type?
): ExecutionContextConfig
Parameters
Name | Type | Default value |
---|---|---|
job | Partial <ValidatedJobConfig > | undefined |
assets | string [] | undefined |
cluster_manager_type | ClusterManagerType | 'native' |
Returns
ExecutionContextConfig
Inherited from
Defined in
teraslice-test-harness/src/base-test-harness.ts:50
runSlice
▸ 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
Name | 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
Defined in
teraslice-test-harness/src/worker-test-harness.ts:118
▸ runSlice(input
, options
): Promise
<DataEntity
<Record
<string
, any
>, _DataEntityMetadata
<Record
<string
, any
>>>[]>
Parameters
Name | Type | |
---|---|---|
input | Slice \ | SliceRequest |
options | Object | |
options.fullResponse | false |
Returns
Promise
<DataEntity
<Record
<string
, any
>, _DataEntityMetadata
<Record
<string
, any
>>>[]>
Defined in
teraslice-test-harness/src/worker-test-harness.ts:121
▸ runSlice(input
, options
): Promise
<RunSliceResult
>
Parameters
Name | Type | |
---|---|---|
input | Slice \ | SliceRequest |
options | Object | |
options.fullResponse | true |
Returns
Promise
<RunSliceResult
>
Defined in
teraslice-test-harness/src/worker-test-harness.ts:125
setClients
▸ setClients(clients
): void
Parameters
Name | Type |
---|---|
clients | TestClientConfig [] |
Returns
void
Inherited from
Defined in
teraslice-test-harness/src/base-test-harness.ts:46
shutdown
▸ shutdown(): Promise
<void
>
Cleanup test code
Returns
Promise
<void
>
Overrides
Defined in
teraslice-test-harness/src/worker-test-harness.ts:175
testFetcher
▸ testFetcher(opConfig
, options?
): default
Parameters
Name | Type |
---|---|
opConfig | OpConfig |
options? | JobHarnessOptions |
Returns
Defined in
teraslice-test-harness/src/worker-test-harness.ts:46
testProcessor
▸ testProcessor(opConfig
, options?
): default
Parameters
Name | Type |
---|---|
opConfig | OpConfig |
options? | JobHarnessOptions |