From e76f6eb2063f7d75cfd05e3bb4b2dac63f63b409 Mon Sep 17 00:00:00 2001 From: misuzu Date: Fri, 3 Jan 2025 19:10:03 +0200 Subject: [PATCH] fix(nats-server): Only one processes is needed --- nix/services/nats-server_test.nix | 59 ++++++++++++++----------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/nix/services/nats-server_test.nix b/nix/services/nats-server_test.nix index 4b677ef..b159674 100644 --- a/nix/services/nats-server_test.nix +++ b/nix/services/nats-server_test.nix @@ -53,41 +53,34 @@ in }; }; - settings.processes = { - nats-test = { - command = pkgs.writeShellApplication { - runtimeInputs = [ pkgs.natscli ]; - text = '' - nats account info -s nats://localhost:4222 - ''; - name = "nats-test"; - }; - depends_on."nats".condition = "process_healthy"; - }; - nats-cluster-test = { - command = pkgs.writeShellApplication { - runtimeInputs = [ pkgs.natscli ]; - text = '' - nats server info -s nats://admin:admin@localhost:14222 + settings.processes.test = { + command = pkgs.writeShellApplication { + runtimeInputs = [ pkgs.natscli ]; + text = '' + # standalone + nats account info -s nats://localhost:4222 + + # nats cluster with jetstream enabled + nats server info -s nats://admin:admin@localhost:14222 - export NATS_URL=nats://js:js@localhost:14222 - nats account info + export NATS_URL=nats://js:js@localhost:14222 + nats account info - # https://docs.nats.io/nats-concepts/jetstream/js_walkthrough - nats stream add my_stream --subjects=foo --storage=memory --replicas=3 --defaults - nats stream info my_stream - nats pub foo --count=5 "publication #{{Count}} @ {{TimeStamp}}" - nats consumer add my_stream pull_consumer --pull --replicas=3 --defaults - nats consumer next my_stream pull_consumer --count 5 - nats stream rm -f my_stream - ''; - name = "nats-cluster-test"; - }; - depends_on = { - "nats-1".condition = "process_healthy"; - "nats-2".condition = "process_healthy"; - "nats-3".condition = "process_healthy"; - }; + # https://docs.nats.io/nats-concepts/jetstream/js_walkthrough + nats stream add my_stream --subjects=foo --storage=memory --replicas=3 --defaults + nats stream info my_stream + nats pub foo --count=5 "publication #{{Count}} @ {{TimeStamp}}" + nats consumer add my_stream pull_consumer --pull --replicas=3 --defaults + nats consumer next my_stream pull_consumer --count 5 + nats stream rm -f my_stream + ''; + name = "nats-test"; + }; + depends_on = { + "nats".condition = "process_healthy"; + "nats-1".condition = "process_healthy"; + "nats-2".condition = "process_healthy"; + "nats-3".condition = "process_healthy"; }; }; }