fix init test bug

This commit is contained in:
Max 2021-10-07 18:23:11 +08:00
parent b51942b116
commit 6ae845c91c
2 changed files with 6 additions and 11 deletions

View file

@ -158,16 +158,17 @@ func (cfg *Config) SetDefaults() {
if cfg.RootDB == "" {
cfg.RootDB = cfg.Root + "/db"
cfg.RootDB = strings.TrimPrefix(cfg.RootDB, "fs://")
cfg.RootDB = strings.TrimPrefix(cfg.RootDB, "file://")
}
if cfg.RootUI == "" {
cfg.RootUI = cfg.Root + "/ui"
cfg.RootUI = strings.TrimPrefix(cfg.RootUI, "fs://")
cfg.RootUI = strings.TrimPrefix(cfg.RootUI, "file://")
}
// 过滤数据
cfg.RootDB = strings.TrimPrefix(cfg.RootDB, "fs://")
cfg.RootDB = strings.TrimPrefix(cfg.RootDB, "file://")
cfg.RootUI = strings.TrimPrefix(cfg.RootUI, "fs://")
cfg.RootUI = strings.TrimPrefix(cfg.RootUI, "file://")
}
// SetEnvFile 指定ENV文件

View file

@ -2,12 +2,10 @@ package global
import (
"os"
"path"
"testing"
"github.com/yaoapp/gou"
"github.com/yaoapp/xiang/config"
"github.com/yaoapp/xiang/table"
)
var cfg config.Config
@ -17,10 +15,6 @@ func TestMain(m *testing.M) {
// 加载模型等
Load(config.Conf)
// 加载表格(临时)
root := "fs://" + path.Join(Conf.Source, "/app/tables/service.json")
table.Load(root, "service").Reload()
// Run test suites
exitVal := m.Run()