MCPcopy
hub / github.com/dgraph-io/dgraph / TestMain

Function TestMain

worker/worker_test.go:503–533  ·  view source on GitHub ↗
(m *testing.M)

Source from the content-addressed store, hash-verified

501}
502
503func TestMain(m *testing.M) {
504 posting.Config.CommitFraction = 0.10
505 gr = new(groupi)
506 gr.gid = 1
507 gr.tablets = make(map[string]*pb.Tablet)
508 addTablets := func(attrs []string, gid uint32, namespace uint64) {
509 for _, attr := range attrs {
510 gr.tablets[x.NamespaceAttr(namespace, attr)] = &pb.Tablet{GroupId: gid}
511 }
512 }
513
514 addTablets([]string{"name", "name2", "age", "http://www.w3.org/2000/01/rdf-schema#range", "",
515 "friend", "dgraph.type", "dgraph.graphql.xid", "dgraph.graphql.schema"},
516 1, x.RootNamespace)
517 addTablets([]string{"friend_not_served"}, 2, x.RootNamespace)
518 addTablets([]string{"name"}, 1, 0x2)
519
520 dir, err := os.MkdirTemp("", "storetest_")
521 x.Check(err)
522 defer os.RemoveAll(dir)
523
524 opt := badger.DefaultOptions(dir)
525 ps, err := badger.OpenManaged(opt)
526 x.Check(err)
527 pstore = ps
528 // Not using posting list cache
529 posting.Init(ps, 0, false)
530 Init(ps)
531
532 m.Run()
533}

Callers

nothing calls this directly

Calls 6

NamespaceAttrFunction · 0.92
CheckFunction · 0.92
InitFunction · 0.92
RemoveAllMethod · 0.80
InitFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected