#!/usr/bin/env bash # Start the netssh test environment: generate the test key, build the images # (netssh from the current source), start everything, and seed NetBox. set -euo pipefail cd "$(dirname "$0")" compose=(docker compose -f compose.yaml) mkdir -p .keys .state chmod a+rwx .state # written by the seed container's user if [ ! -f .keys/id_ed25519 ]; then ssh-keygen -q -t ed25519 -N '' -C netssh-test -f .keys/id_ed25519 cp .keys/id_ed25519.pub .keys/authorized_keys fi # Throwaway test key: readable by the container user; tests copy it with 0600. chmod 644 .keys/id_ed25519 .keys/authorized_keys "${compose[@]}" build "${compose[@]}" up -d --wait --wait-timeout 600 \ postgres redis netbox-fsn netbox-lab bastion fsn1-pve1 fsn1-pve2 fsn1-pve3 \ web1 web2 lab-db1 lab-web1 legacy-box v6-host client "${compose[@]}" run --rm seed echo echo "Test environment is up." echo " Tests: testenv/test.sh [FILTER]" echo " Shell: testenv/shell.sh" echo " NetBox UI: http://127.0.0.1:18000 (fsn), http://127.0.0.1:18001 (lab) — admin / admin"