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

Function TestAddMutation_DelSet

posting/list_test.go:297–324  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

295}
296
297func TestAddMutation_DelSet(t *testing.T) {
298 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 1534)
299 ol, err := GetNoStore(key, math.MaxUint64)
300 require.NoError(t, err)
301 ol.mutationMap.setTs(1)
302
303 // DO sp*, don't commit
304 // Del a value cars and but don't merge.
305 edge := &pb.DirectedEdge{
306 Value: []byte(x.Star),
307 Op: pb.DirectedEdge_DEL,
308 }
309 txn := &Txn{StartTs: 1}
310 require.NoError(t, ol.addMutation(context.Background(), txn, edge))
311
312 // Set value to newcars, commit it
313 edge = &pb.DirectedEdge{
314 Value: []byte("newcars"),
315 }
316 ol1, err := GetNoStore(key, math.MaxUint64)
317 ol1.mutationMap.setTs(2)
318 require.NoError(t, err)
319 txn = &Txn{StartTs: 2}
320 addMutationHelper(t, ol1, edge, Set, txn)
321 require.NoError(t, ol1.commitMutation(2, uint64(3)))
322 require.EqualValues(t, 1, ol1.Length(3, 0))
323 checkValue(t, ol1, "newcars", 3)
324}
325
326func TestAddMutation_DelRead(t *testing.T) {
327 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 1543)

Callers

nothing calls this directly

Calls 9

DataKeyFunction · 0.92
AttrInRootNamespaceFunction · 0.92
GetNoStoreFunction · 0.85
addMutationHelperFunction · 0.85
checkValueFunction · 0.85
setTsMethod · 0.80
addMutationMethod · 0.80
commitMutationMethod · 0.80
LengthMethod · 0.45

Tested by

no test coverage detected