mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: prevent agent_test.go from failing on error logs (#11909)
We're failing tests on error logs like this: https://github.com/coder/coder/actions/runs/7706053882/job/21000984583 Unfortunately, the error we hit, when the underlying connection is closed, is unexported, so we can't specifically ignore it. Part of the issue is that agent.Close() doesn't wait for these goroutines to complete before returning, so the test harness proceeds to close the connection. This looks to our product code like the network connection failing. It would be possible to fix this, but just doesn't seem worth it for the extra insurance of catching other error logs in these tests.
This commit is contained in:
+3
-3
@@ -35,7 +35,6 @@ import (
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/valyala/fasthttp/fasthttputil"
|
||||
"go.uber.org/goleak"
|
||||
"go.uber.org/mock/gomock"
|
||||
"golang.org/x/crypto/ssh"
|
||||
@@ -2028,8 +2027,9 @@ func setupAgent(t *testing.T, metadata agentsdk.Manifest, ptyTimeout time.Durati
|
||||
agent.Agent,
|
||||
) {
|
||||
logger := slogtest.Make(t, &slogtest.Options{
|
||||
// we get this error when closing the Agent API
|
||||
IgnoredErrorIs: append(slogtest.DefaultIgnoredErrorIs, fasthttputil.ErrInmemoryListenerClosed),
|
||||
// Agent can drop errors when shutting down, and some, like the
|
||||
// fasthttplistener connection closed error, are unexported.
|
||||
IgnoreErrors: true,
|
||||
}).Leveled(slog.LevelDebug)
|
||||
if metadata.DERPMap == nil {
|
||||
metadata.DERPMap, _ = tailnettest.RunDERPAndSTUN(t)
|
||||
|
||||
Reference in New Issue
Block a user