pkg/infra: Check errors (#19705)

* pkg/infra: Check errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* pkg/infra: Handle errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/infra/usagestats/usage_stats.go

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Arve Knudsen
2019-10-10 16:42:11 +02:00
committed by GitHub
parent f971b808b8
commit 7349a6b96c
7 changed files with 42 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type CacheableStruct struct {
@@ -29,19 +30,17 @@ func createTestClient(t *testing.T, opts *setting.RemoteCacheOptions, sqlstore *
}
err := dc.Init()
if err != nil {
t.Fatalf("failed to init client for test. error: %v", err)
}
require.Nil(t, err, "Failed to init client for test")
return dc
}
func TestCachedBasedOnConfig(t *testing.T) {
cfg := setting.NewCfg()
cfg.Load(&setting.CommandLineArgs{
err := cfg.Load(&setting.CommandLineArgs{
HomePath: "../../../",
})
require.Nil(t, err, "Failed to load config")
client := createTestClient(t, cfg.RemoteCacheOptions, sqlstore.InitTestDB(t))
runTestsForClient(t, client)