Increase session tests idle timeouts

This commit is contained in:
Devin Carr 2022-03-22 18:34:10 -07:00
parent 46740ece90
commit 4221b5ae07
1 changed files with 6 additions and 4 deletions

View File

@ -111,8 +111,8 @@ func TestReadFromDstSessionPreventClosed(t *testing.T) {
}
func testActiveSessionNotClosed(t *testing.T, readFromDst bool, writeToDst bool) {
const closeAfterIdle = time.Millisecond * 100
const activeTime = time.Millisecond * 500
const closeAfterIdle = time.Millisecond * 500
const activeTime = time.Millisecond * 1000
sessionID := uuid.New()
cfdConn, originConn := net.Pipe()
@ -129,8 +129,10 @@ func testActiveSessionNotClosed(t *testing.T, readFromDst bool, writeToDst bool)
ctx, cancel := context.WithCancel(context.Background())
errGroup, ctx := errgroup.WithContext(ctx)
errGroup.Go(func() error {
session.Serve(ctx, closeAfterIdle)
if time.Now().Before(startTime.Add(activeTime)) {
closed, err := session.Serve(ctx, closeAfterIdle)
require.False(t, closed) // session not closed by remote
require.EqualError(t, err, SessionIdleErr(closeAfterIdle).Error())
if time.Now().Before(activeUntil) {
return fmt.Errorf("session closed while it's still active")
}
return nil