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

Function TestAfterUIDCount2

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

Source from the content-addressed store, hash-verified

881}
882
883func TestAfterUIDCount2(t *testing.T) {
884 key := x.DataKey(x.AttrInRootNamespace("value"), 23)
885 ol, err := readPostingListFromDisk(key, ps, math.MaxUint64)
886 require.NoError(t, err)
887
888 // Set value to cars and merge to BadgerDB.
889 edge := &pb.DirectedEdge{}
890
891 txn := &Txn{StartTs: 1}
892 for i := 100; i < 300; i++ {
893 edge.ValueId = uint64(i)
894 addMutationHelper(t, ol, edge, Set, txn)
895 }
896 require.EqualValues(t, 200, ol.Length(txn.StartTs, 0))
897 require.EqualValues(t, 100, ol.Length(txn.StartTs, 199))
898 require.EqualValues(t, 0, ol.Length(txn.StartTs, 300))
899
900 // Re-insert 1/4 of the edges. Counts should not change.
901 for i := 100; i < 300; i += 4 {
902 edge.ValueId = uint64(i)
903 addMutationHelper(t, ol, edge, Set, txn)
904 }
905 require.EqualValues(t, 200, ol.Length(txn.StartTs, 0))
906 require.EqualValues(t, 100, ol.Length(txn.StartTs, 199))
907 require.EqualValues(t, 0, ol.Length(txn.StartTs, 300))
908}
909
910func TestDelete(t *testing.T) {
911 key := x.DataKey(x.AttrInRootNamespace("value"), 25)

Callers

nothing calls this directly

Calls 5

DataKeyFunction · 0.92
AttrInRootNamespaceFunction · 0.92
addMutationHelperFunction · 0.85
readPostingListFromDiskFunction · 0.70
LengthMethod · 0.45

Tested by

no test coverage detected