From 6ae845c91c0c35293c866903a758d55ba3cd39af Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 7 Oct 2021 18:23:11 +0800 Subject: [PATCH] fix init test bug --- config/config.go | 11 ++++++----- global/init_test.go | 6 ------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/config/config.go b/config/config.go index fec04612..82681184 100644 --- a/config/config.go +++ b/config/config.go @@ -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文件 diff --git a/global/init_test.go b/global/init_test.go index 294144f7..c3760965 100644 --- a/global/init_test.go +++ b/global/init_test.go @@ -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()