MCPcopy Index your code
hub / github.com/apache/answer / TestMain

Function TestMain

plugin/plugin_test/plugin_main_test.go:74–94  ·  view source on GitHub ↗
(t *testing.M)

Source from the content-addressed store, hash-verified

72)
73
74func TestMain(t *testing.M) {
75 dbSetting, ok := dbSettingMapping[os.Getenv("TEST_DB_DRIVER")]
76 if !ok {
77 // Use sqlite3 to test.
78 dbSetting = dbSettingMapping[string(schemas.SQLITE)]
79 }
80 if dbSetting.Driver == string(schemas.SQLITE) {
81 _ = os.RemoveAll(dbSetting.Connection)
82 }
83
84 if err := initTestDataSource(dbSetting); err != nil {
85 panic(err)
86 }
87 log.Info("init test database successfully")
88
89 ret := t.Run()
90 if tearDown != nil {
91 tearDown()
92 }
93 os.Exit(ret)
94}
95
96type TestDBSetting struct {
97 Driver string

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
initTestDataSourceFunction · 0.70
InfoMethod · 0.65

Tested by

no test coverage detected