test: add a local Docker test environment for all features
testenv/ starts two real NetBox 4.7 instances (v2 and v1 token), SSH targets on public, mgmt, and prod networks, a jump host, an IPv6-only host, a static host, and a client with ssh, sftp, scp, tmux, zellij, bash, zsh, and fish. A seed script fills NetBox through the REST API. 141 end-to-end checks cover cache and refresh filters, connecting, all resolver strategies, multiple instances, shortcuts and rewrites, SSH options and rules, static hosts, sftp/scp incl. IPv6 and jump hosts, tunnels, local notes and NetBox comments, completion and shell hooks, the TUI (driven through tmux), the configurator, and uninstall. Local only: testenv/up.sh, test.sh, shell.sh, down.sh. Not part of CI/CD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55e7a5106b
commit
dbb99bdded
34 files changed
+1215
No files matched your search
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/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"
|
||||
Reference in new issue
Block a user