Files
ssh-netbox-wrapper/testenv/up.sh
T
Sebastian Unterschütz 8d4915543e
Test / test (push) Successful in 3m36s
Release / release (push) Successful in 7m31s
v1
2026-11-17 19:00:44 +01:00

27 lines
1.1 KiB
Bash
Executable File

#!/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 .artifacts
chmod a+rwx .state .artifacts # written by the container user (screenshots in .artifacts)
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"