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

Function TestTryLogin_MultipleCachesForSameIP

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

Source from the content-addressed store, hash-verified

127}
128
129func TestTryLogin_MultipleCachesForSameIP(t *testing.T) {
130 cfg, _ := setupSSHTestConfig(t)
131
132 // Add another cache for same IP with different user
133 cfg.ServerLists = append(cfg.ServerLists, config.ServerListConfig{
134 IP: "192.168.1.1",
135 Port: "2222",
136 User: "admin",
137 Password: "adminpass",
138 Alias: "server1-admin",
139 })
140
141 ctrl := NewSSHController("192.168.1.1", cfg)
142 ctrl.TryLogin("", 1, 1*time.Nanosecond)
143
144 assert.Equal(t, "192.168.1.1", ctrl.targetIP)
145 // Should find the first matching cache
146 assert.True(t, ctrl.cacheIsFound)
147 assert.Equal(t, 0, ctrl.cacheIndex)
148}
149
150func TestTryLogin_CacheIndexCorrect(t *testing.T) {
151 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