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>
32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
# Domains, hyphen folding, rewrite rules, alias --test, completion, aliases.
|
|
config <<'EOF'
|
|
resolver:
|
|
strategies: [management_subnet, primary_ip]
|
|
management_subnets: [10.231.1.0/24]
|
|
ssh: {default_user: ops}
|
|
shortcuts:
|
|
domains: [.hoster.test]
|
|
rewrites:
|
|
- pattern: '^([a-z]+)[0-9]+-'
|
|
replace: '$1'
|
|
EOF
|
|
check "refresh" netssh cache refresh
|
|
expect_eq "domain expansion via NetBox" "fsn1-pve1" netssh fsn/fsn1-pve1 hostname
|
|
expect_eq "rewrite shortcut, qualified" "fsn1-pve2" netssh fsn/fsnpve2 hostname
|
|
expect_eq "rewrite shortcut, unqualified" "fsn1-pve3" netssh fsnpve3 hostname
|
|
expect_out "alias --test" "fsn1-pve1.hoster.test → fsnpve1" netssh alias --test fsn1-pve1.hoster.test
|
|
expect_out "completion offers shortcuts" "fsnpve1" netssh __complete fsnp
|
|
expect_out "aliases use the shortcut" "alias fsn_fsnpve1='netssh " netssh alias --shell bash
|
|
expect_fail "unknown shortcut" "host not found" netssh --dry-run fsnpve9
|
|
|
|
config <<'EOF'
|
|
resolver:
|
|
strategies: [management_subnet, primary_ip]
|
|
management_subnets: [10.231.1.0/24]
|
|
shortcuts:
|
|
domains: [.hoster.test]
|
|
strip_hyphens: true
|
|
EOF
|
|
check "refresh" netssh cache refresh
|
|
expect_eq "hyphen folding" "ssh 10.231.1.12" netssh --dry-run fsn/fsn1pve2
|