MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestTryLogin_CacheFound_LaunchFails

Function TestTryLogin_CacheFound_LaunchFails

pkg/control/ssh_integration_test.go:44–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestTryLogin_CacheFound_LaunchFails(t *testing.T) {
45 cfg, _ := setupSSHTestConfig(t)
46
47 ctrl := NewSSHController("192.168.1.1", cfg)
48 // TryLogin will find cache for 192.168.1.1, attempt to Launch (which fails because
49 // no real SSH server), then fall through to tryLoginWithoutCache which also fails.
50 // The test verifies the function completes without panicking and that fields are set.
51 ctrl.TryLogin("root", 1, 1*time.Nanosecond)
52
53 assert.Equal(t, "192.168.1.1", ctrl.targetIP)
54 assert.Equal(t, 1, ctrl.concurrency)
55 assert.Equal(t, 1*time.Nanosecond, ctrl.sshTimeout)
56 // Cache should have been found (user matches)
57 assert.True(t, ctrl.cacheIsFound)
58}
59
60func TestTryLogin_CacheNotFound(t *testing.T) {
61 cfg, _ := setupSSHTestConfig(t)

Callers

nothing calls this directly

Calls 3

TryLoginMethod · 0.95
setupSSHTestConfigFunction · 0.85
NewSSHControllerFunction · 0.85

Tested by

no test coverage detected