MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / TestAddMutation_DelRead

Function TestAddMutation_DelRead

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

Source from the content-addressed store, hash-verified

324}
325
326func TestAddMutation_DelRead(t *testing.T) {
327 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 1543)
328 ol, err := GetNoStore(key, math.MaxUint64)
329 ol.mutationMap.setTs(1)
330 require.NoError(t, err)
331
332 // Set value to newcars, and commit it
333 edge := &pb.DirectedEdge{
334 Value: []byte("newcars"),
335 }
336 txn := &Txn{StartTs: 1}
337 addMutationHelper(t, ol, edge, Set, txn)
338 require.NoError(t, ol.commitMutation(1, uint64(2)))
339 require.EqualValues(t, 1, ol.Length(2, 0))
340 checkValue(t, ol, "newcars", 2)
341
342 // DO sp*, don't commit
343 // Del a value cars and but don't merge.
344 edge = &pb.DirectedEdge{
345 Value: []byte(x.Star),
346 Op: pb.DirectedEdge_DEL,
347 }
348 txn = &Txn{StartTs: 3}
349 require.NoError(t, ol.addMutation(context.Background(), txn, edge))
350
351 // Part of same transaction as sp*, so should see zero length even
352 // if not committed yet.
353 require.EqualValues(t, 0, ol.Length(3, 0))
354
355 // Commit sp* only in oracle, don't apply to pl yet
356 require.NoError(t, ol.commitMutation(3, 5))
357
358 // This read should ignore sp*, since readts is 4 and it was committed at 5
359 require.EqualValues(t, 1, ol.Length(4, 0))
360 checkValue(t, ol, "newcars", 4)
361
362 require.EqualValues(t, 0, ol.Length(6, 0))
363}
364
365func TestAddMutation_jchiu2(t *testing.T) {
366 key := x.DataKey(x.AttrInRootNamespace(x.AttrInRootNamespace("value")), 15)

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
commitMutationMethod · 0.80
addMutationMethod · 0.80
LengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…