Liking cljdoc? Tell your friends :D

temporal.testing.env

Methods and utilities to assist with unit-testing Temporal workflows

Methods and utilities to assist with unit-testing Temporal workflows
raw docstring

createclj

(create)
(create options)

Creates a mock Temporal backend, suitable for unit testing.

A worker may be created with start and a client may be connected with get-client

Arguments:

  • options: Client configuration option map (See below)

options map

ValueDescriptionTypeDefault
:worker-factory-options [[worker/worker-factory-options]]
:workflow-client-options [[client/client-options]]
:workflow-service-stub-options [[client/stub-options]]
:metrics-scopeThe scope to be used for metrics reportingScope
Creates a mock Temporal backend, suitable for unit testing.

A worker may be created with [[start]] and a client may be connected with [[get-client]]

Arguments:

- `options`: Client configuration option map (See below)

#### options map

| Value                           | Description                                   | Type         | Default |
| -------------------------       | --------------------------------------------- | ------------ | ------- |
| :worker-factory-options         |                                               | [[worker/worker-factory-options]] | |
| :workflow-client-options        |                                               | [[client/client-options]] | |
| :workflow-service-stub-options  |                                               | [[client/stub-options]] | |
| :metrics-scope                  | The scope to be used for metrics reporting    | [Scope](https://github.com/uber-java/tally/blob/master/core/src/main/java/com/uber/m3/tally/Scope.java) | |
sourceraw docstring

get-clientclj

(get-client env)

Returns a client instance associated with the mock environment created by create

Returns a client instance associated with the mock environment created by [[create]]
sourceraw docstring

startclj

(start env {:keys [task-queue] :as options})

Starts a Temporal worker associated with the mock environment created with create.

Arguments:

(let [env (create)]
  (start env {:task-queue ::my-queue :ctx {:some "context"}})
  ;; create and invoke workflows
  (stop env))
Starts a Temporal worker associated with the mock environment created with [[create]].

Arguments:

  - `options`:  See [[temporal.client.worker/worker-options]]

```clojure
(let [env (create)]
  (start env {:task-queue ::my-queue :ctx {:some "context"}})
  ;; create and invoke workflows
  (stop env))
```
sourceraw docstring

stopclj

(stop env)

Stops the test environment created by create. Does not wait for shutdown to complete. For coordinated shutdown, see synchronized-stop.

(stop instance)
Stops the test environment created by [[create]].  Does not wait for shutdown to complete.  For coordinated shutdown,
see [[synchronized-stop]].

```clojure
(stop instance)
```
sourceraw docstring

synchronized-stopclj

(synchronized-stop env)

Stops the test environment created by create. Blocks until the environment has shut down. For async termination, see stop

(synchronized-stop instance)
Stops the test environment created by [[create]].  Blocks until the environment has shut down.  For async termination,
see [[stop]]

```clojure
(synchronized-stop instance)
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close