1/**
2 * The `TestRunner` module assembles the smallest cluster runtime useful in
3 * tests: `Sharding` backed by in-memory message storage, in-memory runner
4 * storage, no-op runner transport, and always-healthy runner checks. It lets
5 * code that depends on cluster services exercise registration, shard
6 * coordination, and mailbox persistence without starting RPC servers or
7 * external databases.
8 *
9 * @stability unstable
10 * @since 4.0.0
11 */
12import * as Layer from "../Layer.ts"
13import * as MessageStorage from "./MessageStorage.ts"
14import * as RunnerHealth from "./RunnerHealth.ts"
15import * as Runners from "./Runners.ts"
16import * as RunnerStorage from "./RunnerStorage.ts"
17import * as Sharding from "./Sharding.ts"
18import * as ShardingConfig from "./ShardingConfig.ts"
19
20/**
21 * Layer that provides an in-memory cluster for testing.
22 *
23 * **Details**
24 *
25 * `MessageStorage` and `RunnerStorage` are backed by in-memory drivers.
26 *
27 * @stability unstable
28 * @category layers
29 * @since 4.0.0
30 */
31export const layer: Layer.Layer<
32 Sharding.Sharding | Runners.Runners | MessageStorage.MessageStorage | MessageStorage.MemoryDriver
33> = Sharding.layer.pipe(
34 Layer.provideMerge(Runners.layerNoop),
35 Layer.provideMerge(MessageStorage.layerMemory),
36 Layer.provide([RunnerStorage.layerMemory, RunnerHealth.layerNoop]),
37 Layer.provide(ShardingConfig.layer())
38)