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

Function TestAddMutation_Value

posting/list_test.go:232–252  ·  view source on GitHub ↗

TODO(txn): Add tests after lru eviction

(t *testing.T)

Source from the content-addressed store, hash-verified

230
231// TODO(txn): Add tests after lru eviction
232func TestAddMutation_Value(t *testing.T) {
233 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 10)
234 ol, err := readPostingListFromDisk(key, ps, math.MaxUint64)
235 require.NoError(t, err)
236 edge := &pb.DirectedEdge{
237 Value: []byte("oh hey there"),
238 }
239 txn := &Txn{StartTs: 1}
240 addMutationHelper(t, ol, edge, Set, txn)
241 checkValue(t, ol, "oh hey there", txn.StartTs)
242
243 // Run the same check after committing.
244 require.NoError(t, ol.commitMutation(txn.StartTs, txn.StartTs+1))
245 checkValue(t, ol, "oh hey there", uint64(3))
246
247 // The value made it to the posting list. Changing it now.
248 edge.Value = []byte(strconv.Itoa(119))
249 txn = &Txn{StartTs: 3}
250 addMutationHelper(t, ol, edge, Set, txn)
251 checkValue(t, ol, "119", txn.StartTs)
252}
253
254func TestAddMutation_jchiu1(t *testing.T) {
255 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 12)

Callers

nothing calls this directly

Calls 6

DataKeyFunction · 0.92
AttrInRootNamespaceFunction · 0.92
addMutationHelperFunction · 0.85
checkValueFunction · 0.85
commitMutationMethod · 0.80
readPostingListFromDiskFunction · 0.70

Tested by

no test coverage detected