INNER CODE UNIT · Go
TestGoroutineLeak
yahoo/vssh · client_test.go:186
func TestGoroutineLeak(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)
nGoRoutine := runtime.NumGoroutine()
timeout, _ := time.ParseDuration("6s")
respChan := vs.Run(ctx, "ping", timeout)
resp := <-respChan
resp.GetText(vs)