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

Function populateGraph

worker/worker_test.go:89–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func populateGraph(t *testing.T) {
90 // Add uid edges : predicate neightbour.
91 neighbour := x.AttrInRootNamespace("neighbour")
92 edge := &pb.DirectedEdge{
93 ValueId: 23,
94 Attr: neighbour,
95 }
96 edge.Entity = 10
97 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 10)))
98
99 edge.Entity = 11
100 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 11)))
101
102 edge.Entity = 12
103 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 12)))
104
105 edge.ValueId = 25
106 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 12)))
107
108 edge.ValueId = 26
109 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 12)))
110
111 edge.Entity = 10
112 edge.ValueId = 31
113 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 10)))
114
115 edge.Entity = 12
116 addEdge(t, edge, getOrCreate(x.DataKey(neighbour, 12)))
117
118 // add value edges: friend : with name
119 friend := x.AttrInRootNamespace("friend")
120 edge.Attr = neighbour
121 edge.Entity = 12
122 edge.Value = []byte("photon")
123 edge.ValueId = 0
124 addEdge(t, edge, getOrCreate(x.DataKey(friend, 12)))
125
126 edge.Entity = 10
127 addEdge(t, edge, getOrCreate(x.DataKey(friend, 10)))
128}
129
130func populateClusterGraph(t *testing.T, dg *dgo.Dgraph) {
131 data1 := [][]int{{10, 23}, {11, 23}, {12, 23}, {12, 25}, {12, 26}, {10, 31}, {12, 31}}

Callers 1

initTestFunction · 0.85

Calls 4

AttrInRootNamespaceFunction · 0.92
DataKeyFunction · 0.92
addEdgeFunction · 0.85
getOrCreateFunction · 0.85

Tested by

no test coverage detected