Skip to content

Commit 9843a88

Browse files
authored
pkg/models: Check errors (grafana#19839)
Check errors in pkg/models.
1 parent 8ba5509 commit 9843a88

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/models/datasource_cache_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
. "github.com/smartystreets/goconvey/convey"
12+
"github.com/stretchr/testify/require"
1213

1314
"github.com/grafana/grafana/pkg/components/simplejson"
1415
"github.com/grafana/grafana/pkg/setting"
@@ -201,11 +202,14 @@ func TestDataSourceCache(t *testing.T) {
201202
// Can't use So() here, see: https://github.com/smartystreets/goconvey/issues/561
202203
if r.Header.Get("Authorization") == "Bearer xf5yhfkpsnmgo" {
203204
w.WriteHeader(200)
204-
w.Write([]byte("Ok"))
205+
_, err := w.Write([]byte("Ok"))
206+
require.Nil(t, err)
205207
return
206208
}
209+
207210
w.WriteHeader(403)
208-
w.Write([]byte("Invalid bearer token provided"))
211+
_, err := w.Write([]byte("Invalid bearer token provided"))
212+
require.Nil(t, err)
209213
}))
210214
defer backend.Close()
211215

0 commit comments

Comments
 (0)