Skip to content

Commit

Permalink
Initiallze取消error返回
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Dec 28, 2022
1 parent 4ee6f5a commit 7d4a757
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var dependModules []modules.FarseerModule
var callbackFnList []func()

// Initialize 初始化框架
func Initialize[TModule modules.FarseerModule](appName string) error {
func Initialize[TModule modules.FarseerModule](appName string) {
sw := stopwatch.StartNew()

AppName = appName
Expand Down Expand Up @@ -80,7 +80,6 @@ func Initialize[TModule modules.FarseerModule](appName string) error {
}
}
flog.Println("Initialization completed, total time:" + sw.GetMillisecondsText())
return nil
}

// 组件日志
Expand Down
1 change: 0 additions & 1 deletion test/configure_parseConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
)

type testConfig struct {
dbName string
DataType string
PoolMaxSize int
PoolMinSize int
Expand Down
12 changes: 6 additions & 6 deletions test/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ func TestConfigureGet(t *testing.T) {
assert.Len(t, configure.GetSlice("A.B"), 0)

assert.Equal(t, "DataType=mysql,PoolMaxSize=50,PoolMinSize=1,ConnectionString=root:steden@123@tcp(192.168.1.8:3306)/fss_demo?charset=utf8&parseTime=True&loc=Local", configure.GetString("Database.default"))
os.Setenv("Database_default", "aaa")
_ = os.Setenv("Database_default", "aaa")
assert.Equal(t, "aaa", configure.GetString("Database.default"))
}

func TestErrorConfig(t *testing.T) {
os.Rename("./farseer.yaml", "./farseer.yaml.bak")
_ = os.Rename("./farseer.yaml", "./farseer.yaml.bak")
fs.Initialize[modules.FarseerKernelModule]("unit test")
os.Create("./farseer.yaml")
os.WriteFile("./farseer.yaml", []byte("aaa"), 660)
_, _ = os.Create("./farseer.yaml")
_ = os.WriteFile("./farseer.yaml", []byte("aaa"), 0660)
fs.Initialize[modules.FarseerKernelModule]("unit test")

os.Remove("./farseer.yaml")
os.Rename("./farseer.yaml.bak", "./farseer.yaml")
_ = os.Remove("./farseer.yaml")
_ = os.Rename("./farseer.yaml.bak", "./farseer.yaml")

assert.Panics(t, func() {
fs.Exit(0)
Expand Down
3 changes: 1 addition & 2 deletions test/flog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
)

func TestFlog(t *testing.T) {

configure.ReadInConfig()
_ = configure.ReadInConfig()
flog.Trace("")
flog.Tracef("")
flog.Debug("")
Expand Down

0 comments on commit 7d4a757

Please sign in to comment.