Files
ssh-netbox-wrapper/testenv/tests/01-cache.sh
T
Sebastian UnterschützandClaude Opus 5.5 dbb99bdded 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>
2026-11-14 12:30:24 +01:00

20 lines
1022 B
Bash

# Cache refresh across both NetBox instances, filters, list, search, clear.
config <<'EOF'
resolver:
strategies: [management_subnet, primary_ip]
management_subnets: [10.231.1.0/24]
EOF
expect_out "refresh both instances" "9 entries written" netssh cache refresh
expect_out "list shows mgmt address" "fsn/fsn1-pve1.hoster.test 10.231.1.11" netssh cache list
expect_out "list shows lab VM" "lab/web1 10.231.1.42 vm" netssh cache list
expect_out "IPv6-only host" "fsn/v6-host fd00:30::60" netssh cache list
expect_out "refresh one instance" "2 entries written" netssh cache refresh --instance lab
expect_out "refresh by tag" "3 entries written" netssh cache refresh --tag pve
expect_out "refresh by kind" "3 entries written" netssh cache refresh --kind vm
expect_eq "search" "fsn/fsn1-pve1.hoster.test
fsn/fsn1-pve2.hoster.test
fsn/fsn1-pve3.hoster.test" bash -c 'netssh search fsn1 | sort'
check "clear" netssh cache clear
expect_eq "empty after clear" "" bash -c 'netssh search fsn'