-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade dependencies #546
Upgrade dependencies #546
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ import ( | |||||
"github.com/plgd-dev/go-coap/v3/pkg/runner/periodic" | ||||||
"github.com/plgd-dev/go-coap/v3/udp/client" | ||||||
"github.com/plgd-dev/go-coap/v3/udp/coder" | ||||||
"github.com/stretchr/testify/assert" | ||||||
"github.com/stretchr/testify/require" | ||||||
"go.uber.org/atomic" | ||||||
"golang.org/x/sync/semaphore" | ||||||
|
@@ -67,7 +68,7 @@ func TestServerCleanUpConns(t *testing.T) { | |||||
go func() { | ||||||
defer wg.Done() | ||||||
errS := sd.Serve(ld) | ||||||
require.NoError(t, errS) | ||||||
assert.NoError(t, errS) | ||||||
}() | ||||||
|
||||||
cc, err := dtls.Dial(ld.Addr().String(), dtlsCfg) | ||||||
|
@@ -174,7 +175,7 @@ func TestServerSetContextValueWithPKI(t *testing.T) { | |||||
defer sd.Stop() | ||||||
go func() { | ||||||
errS := sd.Serve(ld) | ||||||
require.NoError(t, errS) | ||||||
assert.NoError(t, errS) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adopt - require.NoError(t, errS)
+ assert.NoError(t, errS) This modification enhances error reporting by allowing multiple failures to be captured in one test execution. Committable suggestion
Suggested change
|
||||||
}() | ||||||
|
||||||
cc, err := dtls.Dial(ld.Addr().String(), clientCgf) | ||||||
|
@@ -233,7 +234,7 @@ func TestServerInactiveMonitor(t *testing.T) { | |||||
go func() { | ||||||
defer serverWg.Done() | ||||||
errS := sd.Serve(ld) | ||||||
require.NoError(t, errS) | ||||||
assert.NoError(t, errS) | ||||||
Danielius1922 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}() | ||||||
|
||||||
cc, err := dtls.Dial(ld.Addr().String(), clientCgf) | ||||||
|
@@ -305,7 +306,7 @@ func TestServerKeepAliveMonitor(t *testing.T) { | |||||
go func() { | ||||||
defer serverWg.Done() | ||||||
errS := sd.Serve(ld) | ||||||
require.NoError(t, errS) | ||||||
assert.NoError(t, errS) | ||||||
Danielius1922 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}() | ||||||
|
||||||
cc, err := piondtls.Dial("udp4", &net.UDPAddr{IP: []byte{127, 0, 0, 1}, Port: ld.Addr().(*net.UDPAddr).Port}, clientCgf) | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ package status | |||||||||||||||
|
||||||||||||||||
import ( | ||||||||||||||||
"context" | ||||||||||||||||
"fmt" | ||||||||||||||||
"errors" | ||||||||||||||||
"testing" | ||||||||||||||||
|
||||||||||||||||
"github.com/plgd-dev/go-coap/v3/message/codes" | ||||||||||||||||
|
@@ -15,7 +15,7 @@ func TestStatus(t *testing.T) { | |||||||||||||||
require.True(t, ok) | ||||||||||||||||
require.Equal(t, OK, s.Code()) | ||||||||||||||||
|
||||||||||||||||
_, ok = FromError(fmt.Errorf("test")) | ||||||||||||||||
_, ok = FromError(errors.New("test")) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace - _, ok = FromError(errors.New("test"))
+ _, ok = FromError(errors.New("test")) This change aligns with best practices for creating errors without formatting directives. Committable suggestion
Suggested change
|
||||||||||||||||
require.False(t, ok) | ||||||||||||||||
|
||||||||||||||||
msg := pool.NewMessage(context.TODO()) | ||||||||||||||||
|
@@ -42,7 +42,7 @@ func TestStatus(t *testing.T) { | |||||||||||||||
err = FromContextError(context.DeadlineExceeded) | ||||||||||||||||
require.Equal(t, Timeout, Code(err)) | ||||||||||||||||
|
||||||||||||||||
err = FromContextError(fmt.Errorf("test")) | ||||||||||||||||
err = FromContextError(errors.New("test")) | ||||||||||||||||
require.Equal(t, Unknown, Code(err)) | ||||||||||||||||
require.Equal(t, Unknown, Code(fmt.Errorf("test"))) | ||||||||||||||||
require.Equal(t, Unknown, Code(errors.New("test"))) | ||||||||||||||||
Comment on lines
+45
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure consistent error creation using - err = FromContextError(errors.New("test"))
+ err = FromContextError(errors.New("test")) This modification improves readability and efficiency when no formatting is needed. Committable suggestion
Suggested change
|
||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ import ( | |||||
|
||||||
"github.com/plgd-dev/go-coap/v3/message/codes" | ||||||
"github.com/plgd-dev/go-coap/v3/message/pool" | ||||||
"github.com/stretchr/testify/assert" | ||||||
"github.com/stretchr/testify/require" | ||||||
"go.uber.org/atomic" | ||||||
) | ||||||
|
@@ -146,7 +147,7 @@ func TestLimitParallelRequestsDo(t *testing.T) { | |||||
go func(r *pool.Message) { | ||||||
defer wg.Done() | ||||||
_, err := c.Do(r) | ||||||
require.Error(t, err) | ||||||
assert.Error(t, err) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change - require.Error(t, err)
+ assert.Error(t, err) This modification encourages the collection of multiple test failures in a single test run. Committable suggestion
Suggested change
|
||||||
}(req) | ||||||
} | ||||||
wg.Wait() | ||||||
|
@@ -269,7 +270,7 @@ func TestLimitParallelRequestsDoObserve(t *testing.T) { | |||||
_, err := c.DoObserve(r, func(*pool.Message) { | ||||||
// do nothing | ||||||
}) | ||||||
require.Error(t, err) | ||||||
assert.Error(t, err) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adopt - require.Error(t, err)
+ assert.Error(t, err) This change allows for more comprehensive error reporting within a single test execution. Committable suggestion
Suggested change
|
||||||
}(req) | ||||||
} | ||||||
wg.Wait() | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transition to
assert.NoError
for non-terminating assertions within tests.This change facilitates the identification of multiple issues within a single test run.
Committable suggestion