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

Function TestSSHController_TryLogin_WithCacheFound

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

Source from the content-addressed store, hash-verified

42}
43
44func TestSSHController_TryLogin_WithCacheFound(t *testing.T) {
45 cfg := newTestMainConfig()
46 ctrl := NewSSHController("192.168.1.1", cfg)
47
48 // TryLogin calls into SSH launchers which need actual SSH connections.
49 // We test the configuration resolution and cache lookup logic.
50 ctrl.targetIP = config.ResolveAlias(ctrl.targetIP, ctrl.configuration)
51 assert.Equal(t, "192.168.1.1", ctrl.targetIP)
52
53 server, idx, found := config.SelectServerCache("root", ctrl.targetIP, ctrl.configuration)
54 assert.True(t, found)
55 assert.NotNil(t, server)
56 assert.Equal(t, 0, idx)
57 assert.Equal(t, "192.168.1.1", server.IP)
58 assert.Equal(t, "root", server.User)
59}
60
61func TestSSHController_TryLogin_CacheNotFound(t *testing.T) {
62 cfg := newTestMainConfig()

Callers

nothing calls this directly

Calls 4

ResolveAliasFunction · 0.92
SelectServerCacheFunction · 0.92
newTestMainConfigFunction · 0.85
NewSSHControllerFunction · 0.85

Tested by

no test coverage detected