MCPcopy
hub / github.com/tinode/chat / init

Function init

server/db/rethinkdb/tests/rethink_test.go:1550–1579  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1548}
1549
1550func init() {
1551 logs.Init(os.Stderr, "stdFlags")
1552 adp = backend.GetTestAdapter()
1553 conffile := flag.String("config", "./test.conf", "config of the database connection")
1554
1555 if file, err := os.Open(*conffile); err != nil {
1556 log.Fatal("Failed to read config file:", err)
1557 } else if err = json.NewDecoder(jcr.New(file)).Decode(&config); err != nil {
1558 log.Fatal("Failed to parse config file:", err)
1559 }
1560
1561 if adp == nil {
1562 log.Fatal("Database adapter is missing")
1563 }
1564 if adp.IsOpen() {
1565 log.Print("Connection is already opened")
1566 }
1567
1568 err := adp.Open(config.Adapters[adp.GetName()])
1569 if err != nil {
1570 log.Fatal(err)
1571 }
1572
1573 conn = adp.GetTestDB().(*rdb.Session)
1574 testData = test_data.InitTestData()
1575 if testData == nil {
1576 log.Fatal("Failed to initialize test data")
1577 }
1578 store.SetTestUidGenerator(*testData.UGen)
1579}

Callers

nothing calls this directly

Calls 8

InitFunction · 0.92
InitTestDataFunction · 0.92
SetTestUidGeneratorFunction · 0.92
OpenMethod · 0.65
IsOpenMethod · 0.65
GetNameMethod · 0.65
GetTestDBMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…