()
| 7 | ) |
| 8 | |
| 9 | func newTestConfig() *MainConfig { |
| 10 | conf := &MainConfig{} |
| 11 | conf.Main.Ports = []string{"22"} |
| 12 | conf.Main.Users = []string{"root"} |
| 13 | conf.Main.Passwords = []string{"pass1"} |
| 14 | conf.Main.Keys = []string{"/key1"} |
| 15 | conf.ServerLists = []ServerListConfig{ |
| 16 | { |
| 17 | IP: "192.168.1.1", |
| 18 | Port: "22", |
| 19 | User: "root", |
| 20 | Password: "pass1", |
| 21 | Key: "/key1", |
| 22 | Alias: "server1", |
| 23 | }, |
| 24 | { |
| 25 | IP: "192.168.1.2", |
| 26 | Port: "2222", |
| 27 | User: "admin", |
| 28 | Password: "pass2", |
| 29 | Key: "/key2", |
| 30 | Alias: "server2", |
| 31 | }, |
| 32 | { |
| 33 | IP: "192.168.1.1", |
| 34 | Port: "22", |
| 35 | User: "admin", |
| 36 | Password: "pass3", |
| 37 | Key: "/key3", |
| 38 | Alias: "server1-admin", |
| 39 | }, |
| 40 | { |
| 41 | IP: "10.0.0.1", |
| 42 | Port: "22", |
| 43 | User: "deploy", |
| 44 | Password: "deploy-pass", |
| 45 | Alias: "", |
| 46 | }, |
| 47 | } |
| 48 | return conf |
| 49 | } |
| 50 | |
| 51 | func TestSelectServerCache_MatchingIP(t *testing.T) { |
| 52 | conf := newTestConfig() |
no outgoing calls
no test coverage detected