From 7ce9552d17b393b20389055745b8eb3052de2cfa Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 7 Oct 2021 18:31:46 +0800 Subject: [PATCH] fix load test bug --- global/load_test.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/global/load_test.go b/global/load_test.go index 25901c0c..82dbfbb9 100644 --- a/global/load_test.go +++ b/global/load_test.go @@ -5,18 +5,21 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/yaoapp/xiang/config" "github.com/yaoapp/xiang/table" ) func TestLoad(t *testing.T) { + defer Load(config.Conf) assert.NotPanics(t, func() { - Load(Conf) + Load(config.Conf) }) } // 从文件系统载入引擎文件 func TestLoadEngineFS(t *testing.T) { - root := "fs://" + path.Join(Conf.Source, "/xiang") + defer Load(config.Conf) + root := "fs://" + path.Join(config.Conf.Source, "/xiang") assert.NotPanics(t, func() { LoadEngine(root) }) @@ -25,6 +28,7 @@ func TestLoadEngineFS(t *testing.T) { // 从BinDataz载入引擎文件 func TestLoadEngineBin(t *testing.T) { + defer Load(config.Conf) root := "bin://xiang" assert.NotPanics(t, func() { LoadEngine(root) @@ -33,21 +37,22 @@ func TestLoadEngineBin(t *testing.T) { // 从文件系统载入应用脚本 func TestLoadAppFS(t *testing.T) { + defer Load(config.Conf) assert.NotPanics(t, func() { LoadApp(AppRoot{ - APIs: Conf.RootAPI, - Flows: Conf.RootFLow, - Models: Conf.RootModel, - Plugins: Conf.RootPlugin, - Tables: Conf.RootTable, - Charts: Conf.RootChart, - Screens: Conf.RootScreen, + APIs: config.Conf.RootAPI, + Flows: config.Conf.RootFLow, + Models: config.Conf.RootModel, + Plugins: config.Conf.RootPlugin, + Tables: config.Conf.RootTable, + Charts: config.Conf.RootChart, + Screens: config.Conf.RootScreen, }) }) } func TestTableLoad(t *testing.T) { - + defer Load(config.Conf) table, has := table.Tables["service"] assert.Equal(t, table.Table, "service") assert.True(t, has)