multimachine.sh

1.8 KB · raw

1#!/usr/bin/env sh2# G-12 multi-machine ROUTING validation via SSH-to-self: test-remote points at3# 127.0.0.1, so `--on test-remote` exercises nina's full SSH routing (build ssh4# argv, connect, run remotely, parse output) and `status --all` aggregation.5# CAVEAT: test-remote IS this machine, so this validates the --on plumbing, NOT6# physical isolation (separate generation counts need two real networked VMs).7set -u8N=/root/nina910echo "KILN_MM_BEGIN"1112mkdir -p /root/.ssh && chmod 700 /root/.ssh13ssh-keygen -t ed25519 -N '' -f /root/.ssh/id_test </dev/null >/dev/null 2>&114cat /root/.ssh/id_test.pub >> /root/.ssh/authorized_keys15chmod 600 /root/.ssh/authorized_keys1617cat > /root/.nina.conf <<EOF18editor      = vim19generations = 520confirm     = false21teach       = true22color       = true2324[machine]25name    = test-primary26config  = /etc/nixos27local   = true28default = true2930[machine]31name    = test-remote32host    = 127.0.0.133user    = root34ssh_key = /root/.ssh/id_test35EOF3637echo "### T-153 nina hello (test-primary local, test-remote ssh)"38$N hello </dev/null; echo "HELLO_RC=$?"3940echo "### T-160 nina status --all (both machines in table)"41$N status --all </dev/null; echo "STATUSALL_RC=$?"4243echo "### T-164 nina history --on test-remote (via ssh)"44$N history --on test-remote </dev/null; echo "HISTREMOTE_RC=$?"4546echo "### T-166 nina service list --on test-remote (via ssh)"47$N service list --on test-remote </dev/null; echo "SVCREMOTE_RC=$?"4849echo "### T-165 nina doctor --on test-remote (via ssh)"50$N doctor --on test-remote </dev/null; echo "DOCTORREMOTE_RC=$?"5152echo "### T-162 nina apply --on test-remote (ssh -> nixos-rebuild switch on self)"53$N apply --on test-remote </dev/null; echo "APPLYREMOTE_RC=$?"5455echo "### T-167 nina status --on ghost-machine (expect error)"56$N status --on ghost-machine </dev/null; echo "GHOST_RC=$?"5758echo "KILN_MM_END"