mirror of https://github.com/coder/coder.git
chore: give additional time in tests for `tailnetAPIConnector` graceful disconnect (#12980)
Failure seen here: https://github.com/coder/coder/actions/runs/8711258577/job/23894964182?pr=12979
This commit is contained in:
parent
3338cdca77
commit
6b4eb03192
|
@ -20,6 +20,8 @@ import (
|
||||||
"github.com/coder/retry"
|
"github.com/coder/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var tailnetConnectorGracefulTimeout = time.Second
|
||||||
|
|
||||||
// tailnetConn is the subset of the tailnet.Conn methods that tailnetAPIConnector uses. It is
|
// tailnetConn is the subset of the tailnet.Conn methods that tailnetAPIConnector uses. It is
|
||||||
// included so that we can fake it in testing.
|
// included so that we can fake it in testing.
|
||||||
//
|
//
|
||||||
|
@ -86,7 +88,7 @@ func runTailnetAPIConnector(
|
||||||
func (tac *tailnetAPIConnector) manageGracefulTimeout() {
|
func (tac *tailnetAPIConnector) manageGracefulTimeout() {
|
||||||
defer tac.cancelGracefulCtx()
|
defer tac.cancelGracefulCtx()
|
||||||
<-tac.ctx.Done()
|
<-tac.ctx.Done()
|
||||||
timer := time.NewTimer(time.Second)
|
timer := time.NewTimer(tailnetConnectorGracefulTimeout)
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-tac.closed:
|
case <-tac.closed:
|
||||||
|
|
|
@ -24,6 +24,11 @@ import (
|
||||||
"github.com/coder/coder/v2/testutil"
|
"github.com/coder/coder/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Give tests a bit more time to timeout. Darwin is particularly slow.
|
||||||
|
tailnetConnectorGracefulTimeout = 5 * time.Second
|
||||||
|
}
|
||||||
|
|
||||||
func TestTailnetAPIConnector_Disconnects(t *testing.T) {
|
func TestTailnetAPIConnector_Disconnects(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testCtx := testutil.Context(t, testutil.WaitShort)
|
testCtx := testutil.Context(t, testutil.WaitShort)
|
||||||
|
|
Loading…
Reference in New Issue