Methods and utilities to assist with unit-testing Temporal workflows
Methods and utilities to assist with unit-testing Temporal workflows
(create queue-name)
(create queue-name ctx)
Creates a mock environment and an associated client connection for emulating the combination of a worker and a Temporal backend, suitable for unit testing.
Arguments:
queue-name
: The name of the task-queue for mock worker instance to listen on. Accepts a string or fully-qualified
keyword.ctx
: (optional) an opaque handle that is passed as the first argument of temporal.workflow/defworkflow
and temporal.activity/defactivity
. Useful for passing state such as database or network
connections. Not interpreted in any manner.(let [{:keys [client] :as instance} (create ::my-queue {:some "context"}]
;; create and invoke workflows
(stop instance))
Creates a mock environment and an associated client connection for emulating the combination of a worker and a Temporal backend, suitable for unit testing. Arguments: - `queue-name`: The name of the task-queue for mock worker instance to listen on. Accepts a string or fully-qualified keyword. - `ctx`: (optional) an opaque handle that is passed as the first argument of [[temporal.workflow/defworkflow]] and [[temporal.activity/defactivity]]. Useful for passing state such as database or network connections. Not interpreted in any manner. ```clojure (let [{:keys [client] :as instance} (create ::my-queue {:some "context"}] ;; create and invoke workflows (stop instance)) ```
(stop {:keys [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 {:keys [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