MCPcopy Index your code
hub / github.com/dnote/dnote / OpenTestDB

Function OpenTestDB

pkg/cli/database/testutils.go:112–120  ·  view source on GitHub ↗

OpenTestDB opens the database connection to a test database without initializing any schema

(t *testing.T, dnoteDir string)

Source from the content-addressed store, hash-verified

110// OpenTestDB opens the database connection to a test database
111// without initializing any schema
112func OpenTestDB(t *testing.T, dnoteDir string) *DB {
113 dbPath := fmt.Sprintf("%s/%s/%s", dnoteDir, consts.DnoteDirName, consts.DnoteDBFileName)
114 db, err := Open(dbPath)
115 if err != nil {
116 t.Fatal(errors.Wrap(err, "opening database connection to the test database"))
117 }
118
119 return db
120}
121
122// mustGenerateTestUUID generates a UUID for test databases and fails the test on error
123func mustGenerateTestUUID(t *testing.T) string {

Callers 2

TestInitFunction · 0.92
TestAddNoteFunction · 0.92

Calls 1

OpenFunction · 0.70

Tested by 2

TestInitFunction · 0.74
TestAddNoteFunction · 0.74