Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit426b18c

Browse files
authored
Fix dial tests (#439)
1 parenta778c5f commit426b18c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎wsnet/dial.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ func Dial(ctx context.Context, conn net.Conn, options *DialOptions) (*Dialer, er
178178

179179
err=dialer.negotiate(ctx)
180180
iferr!=nil {
181-
returnnil,xerrors.Errorf("negotiate rtc connection: %w",err)
181+
// Return the dialer since we have tests that verify things are closed
182+
// if negotiation fails.
183+
returndialer,xerrors.Errorf("negotiate rtc connection: %w",err)
182184
}
183185

184186
returndialer,nil

‎wsnet/dial_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ func TestDial(t *testing.T) {
6262
defercancelFunc()
6363
dialer,err:=DialWebsocket(ctx,connectAddr,nil,nil)
6464
require.True(t,errors.Is(err,context.DeadlineExceeded))
65+
require.NotNil(t,dialer)
6566
require.Error(t,dialer.conn.Close(),"already wrote close")
67+
68+
// Ensure the rtc peer connection is closed. Setting the config options
69+
// to empty struct does nothing, but it does fail if the rtc peer conn
70+
// is closed.
71+
err=dialer.rtc.SetConfiguration(webrtc.Configuration{})
72+
require.Error(t,err)
73+
require.ErrorIs(t,err,webrtc.ErrConnectionClosed)
6674
})
6775

6876
t.Run("Ping",func(t*testing.T) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp