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
@@ -0,0 +1,25 @@
|
||||
# Static hosts without any NetBox: config, CLI, own user/port/options, rules.
|
||||
config_only <<'EOF'
|
||||
ssh:
|
||||
default_user: ops
|
||||
rules:
|
||||
- match: {kind: static, tag: legacy}
|
||||
options: {ServerAliveInterval: "15"}
|
||||
hosts:
|
||||
- name: legacy-box
|
||||
address: 10.231.0.50
|
||||
user: admin
|
||||
tags: [legacy]
|
||||
EOF
|
||||
expect_eq "connect to a static host" "legacy-box" netssh legacy-box hostname
|
||||
expect_eq "static user" "admin" netssh legacy-box whoami
|
||||
expect_out "rule by kind and tag" "-o serveraliveinterval=15" netssh --dry-run legacy-box
|
||||
expect_eq "-l still wins" "ops" netssh -l ops legacy-box whoami
|
||||
check "hosts add" netssh hosts add box2 10.231.0.50 --port 2222 --tag lab
|
||||
expect_eq "hosts list" "box2 10.231.0.50 2222 lab" bash -c 'netssh hosts list | grep "^box2" | tr -s " "'
|
||||
expect_out "static port" " 2222" netssh box2 'echo $SSH_CONNECTION'
|
||||
expect_out "completion" "box2" netssh __complete bo
|
||||
expect_fail "duplicate" "already exists" netssh hosts add box2 10.0.0.1
|
||||
check "hosts remove" netssh hosts remove box2
|
||||
expect_fail "removed host is gone" "no NetBox is configured" netssh --dry-run box2
|
||||
expect_eq "sftp to a static host" "Remote working directory: /home/admin" bash -c 'echo pwd | netssh sftp -b - legacy-box | grep Remote'
|
||||
Reference in new issue
Block a user