Skip to content

Commit

Permalink
Merge pull request #222 from kzys/lint-err
Browse files Browse the repository at this point in the history
Check errors in tests
  • Loading branch information
youyuanwu committed Oct 25, 2021
2 parents 17a5a82 + dc602df commit 2cdef49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/keepalive_test.go
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func newCountingReader(rdr io.Reader, readOnce bool) *countingReadCloser {
Expand Down Expand Up @@ -45,7 +46,8 @@ func TestDrainingReadCloser(t *testing.T) {

buf := make([]byte, 5)
ts := &drainingReadCloser{rdr: rdr}
ts.Read(buf)
_, err := ts.Read(buf)
require.NoError(t, err)
ts.Close()
assert.Equal(t, "There", string(buf))
assert.Equal(t, " are many things to do", disc.String())
Expand All @@ -62,8 +64,9 @@ func TestDrainingReadCloser_SeenEOF(t *testing.T) {

buf := make([]byte, 5)
ts := &drainingReadCloser{rdr: rdr}
ts.Read(buf)
_, err := ts.Read(nil)
_, err := ts.Read(buf)
assert.NoError(t, err)
_, err = ts.Read(nil)
assert.Equal(t, io.EOF, err)
ts.Close()
assert.Equal(t, string(buf), "There")
Expand Down
2 changes: 2 additions & 0 deletions client/runtime_test.go
Expand Up @@ -86,6 +86,7 @@ func TestRuntime_TLSAuthConfigWithRSAKey(t *testing.T) {
require.NotNil(t, certDer)

cert, err := x509.ParseCertificate(certDer.Bytes)
require.NoError(t, err)

var opts TLSClientOptions
opts.LoadedKey = key
Expand Down Expand Up @@ -117,6 +118,7 @@ func TestRuntime_TLSAuthConfigWithECKey(t *testing.T) {
require.NotNil(t, certDer)

cert, err := x509.ParseCertificate(certDer.Bytes)
require.NoError(t, err)

var opts TLSClientOptions
opts.LoadedKey = key
Expand Down

0 comments on commit 2cdef49

Please sign in to comment.