Methods and utilities to assist with unit-testing Temporal workflows
Methods and utilities to assist with unit-testing Temporal workflows
(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)Value | Description | Type | Default |
---|---|---|---|
:worker-factory-options | [[worker/worker-factory-options]] | ||
:workflow-client-options | [[copts/client-options]] | ||
:workflow-service-stub-options | [[copts/stub-options]] | ||
:metrics-scope | The scope to be used for metrics reporting | Scope |
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 | | [[copts/client-options]] | | | :workflow-service-stub-options | | [[copts/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) | |
(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]]
(start env {:keys [task-queue] :as options})
Starts a Temporal worker associated with the mock environment created with create
.
Arguments:
options
: See temporal.client.worker/worker-options
(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)) ```
(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) ```
(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) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close