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>
23 lines
1.2 KiB
Bash
23 lines
1.2 KiB
Bash
# Local notes and NetBox comments (v2 token on fsn, v1 token on lab).
|
|
config <<'EOF'
|
|
resolver:
|
|
strategies: [management_subnet, primary_ip]
|
|
management_subnets: [10.231.1.0/24]
|
|
EOF
|
|
check "refresh" netssh cache refresh
|
|
host=fsn/fsn1-pve1.hoster.test
|
|
check "set local note" netssh notes set $host "first line"
|
|
check "append local note" netssh notes append $host "second line"
|
|
expect_eq "show local note" "first line
|
|
second line" netssh notes show $host
|
|
expect_eq "note from stdin" "piped" bash -c "echo piped | netssh notes set $host && netssh notes show $host"
|
|
|
|
expect_eq "read NetBox comments (v2 token)" "Proxmox node 1" netssh notes show $host --netbox
|
|
check "append NetBox comments" netssh notes append $host --netbox "checked by netssh test"
|
|
expect_out "NetBox has the new line" "checked by netssh test" curl -s -H "Authorization: Bearer $FSN_TOKEN" "$FSN_URL/api/dcim/devices/?name=fsn1-pve1.hoster.test"
|
|
check "restore NetBox comments" netssh notes set $host --netbox "Proxmox node 1"
|
|
|
|
check "set NetBox comments (v1 token)" netssh notes set lab/lab-db1 --netbox "lab note"
|
|
expect_eq "read them back" "lab note" netssh notes show lab/lab-db1 --netbox
|
|
check "clear them" netssh notes set lab/lab-db1 --netbox ""
|