Skip to content
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

Check errors in tests #222

Merged
merged 1 commit into from Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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