Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings * settings: progress on settings refactor * refactor: progress on settings refactoring * fix: fixed failing test * settings: moved smtp settings from global to instance
This commit is contained in:
@@ -87,8 +87,8 @@ func TestDashboardImport(t *testing.T) {
|
||||
|
||||
func pluginScenario(desc string, t *testing.T, fn func()) {
|
||||
Convey("Given a plugin", t, func() {
|
||||
setting.Cfg = ini.Empty()
|
||||
sec, _ := setting.Cfg.NewSection("plugin.test-app")
|
||||
setting.Raw = ini.Empty()
|
||||
sec, _ := setting.Raw.NewSection("plugin.test-app")
|
||||
sec.NewKey("path", "../../tests/test-app")
|
||||
|
||||
pm := &PluginManager{}
|
||||
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
func TestPluginDashboards(t *testing.T) {
|
||||
|
||||
Convey("When asking plugin dashboard info", t, func() {
|
||||
setting.Cfg = ini.Empty()
|
||||
sec, _ := setting.Cfg.NewSection("plugin.test-app")
|
||||
setting.Raw = ini.Empty()
|
||||
sec, _ := setting.Raw.NewSection("plugin.test-app")
|
||||
sec.NewKey("path", "../../tests/test-app")
|
||||
|
||||
pm := &PluginManager{}
|
||||
|
||||
@@ -132,7 +132,7 @@ func (pm *PluginManager) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func checkPluginPaths() error {
|
||||
for _, section := range setting.Cfg.Sections() {
|
||||
for _, section := range setting.Raw.Sections() {
|
||||
if strings.HasPrefix(section.Name(), "plugin.") {
|
||||
path := section.Key("path").String()
|
||||
if path != "" {
|
||||
|
||||
@@ -13,7 +13,7 @@ func TestPluginScans(t *testing.T) {
|
||||
|
||||
Convey("When scanning for plugins", t, func() {
|
||||
setting.StaticRootPath, _ = filepath.Abs("../../public/")
|
||||
setting.Cfg = ini.Empty()
|
||||
setting.Raw = ini.Empty()
|
||||
|
||||
pm := &PluginManager{}
|
||||
err := pm.Init()
|
||||
@@ -28,8 +28,8 @@ func TestPluginScans(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("When reading app plugin definition", t, func() {
|
||||
setting.Cfg = ini.Empty()
|
||||
sec, _ := setting.Cfg.NewSection("plugin.nginx-app")
|
||||
setting.Raw = ini.Empty()
|
||||
sec, _ := setting.Raw.NewSection("plugin.nginx-app")
|
||||
sec.NewKey("path", "../../tests/test-app")
|
||||
|
||||
pm := &PluginManager{}
|
||||
|
||||
Reference in New Issue
Block a user