2019-04-22 10:58:24 -05:00
|
|
|
package setting
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2021-10-26 06:19:07 -05:00
|
|
|
"github.com/stretchr/testify/require"
|
2023-01-30 02:26:42 -06:00
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/infra/log/logtest"
|
2019-04-22 10:58:24 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestSessionSettings(t *testing.T) {
|
2021-10-26 06:19:07 -05:00
|
|
|
skipStaticRootValidation = true
|
2019-04-22 10:58:24 -05:00
|
|
|
|
2021-10-26 06:19:07 -05:00
|
|
|
t.Run("Reading session should log error ", func(t *testing.T) {
|
|
|
|
cfg := NewCfg()
|
|
|
|
homePath := "../../"
|
2019-04-22 10:58:24 -05:00
|
|
|
|
2022-05-06 10:44:22 -05:00
|
|
|
logger := &logtest.Fake{}
|
|
|
|
cfg.Logger = logger
|
2019-04-22 10:58:24 -05:00
|
|
|
|
2021-10-26 06:19:07 -05:00
|
|
|
err := cfg.Load(CommandLineArgs{
|
|
|
|
HomePath: homePath,
|
|
|
|
Config: filepath.Join(homePath, "pkg/setting/testdata/session.ini"),
|
2019-04-22 10:58:24 -05:00
|
|
|
})
|
2021-10-26 06:19:07 -05:00
|
|
|
require.Nil(t, err)
|
|
|
|
|
2022-05-06 10:44:22 -05:00
|
|
|
require.Equal(t, 1, logger.WarnLogs.Calls)
|
|
|
|
require.Greater(t, len(logger.WarnLogs.Message), 0)
|
2019-04-22 10:58:24 -05:00
|
|
|
})
|
|
|
|
}
|