INNER CODE UNIT · Go
TestAddClient
yahoo/vssh · client_test.go:73
func TestAddClient(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
config := GetConfigUserPass("vssh", "vssh")
vs := New().StartWithContext(ctx)
vs.AddClient("127.0.0.1:22", config)
_, ok := vs.clients.get("127.0.0.1:22")
if !ok {
t.Error("expect to have 127.0.0.1:22 client but not exist")
}
_, ok = vs.clients.get("127.0.0.2:22")
if ok {
t.Error("expect to have not 127.0.0.2:22 but it's exist")
}