INNER CODE UNIT · Go
TestTimeout
yahoo/vssh · client_test.go:161
func TestTimeout(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
config := GetConfigUserPass("vssh", "vssh")
vs := New().StartWithContext(ctx)
vs.AddClient(testSrvAddr, config, SetMaxSessions(1), DisableRequestPty())
vs.Wait()
time.Sleep(time.Second)
timeout, _ := time.ParseDuration("1s")
respChan := vs.Run(ctx, "ping", timeout)
now := time.Now()
resp := <-respChan
_, _, err := resp.GetText(vs)