MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestMultiPartListDelete

Function TestMultiPartListDelete

posting/list_test.go:1380–1400  ·  view source on GitHub ↗

Verify that adding and deleting all the entries returns an empty list.

(t *testing.T)

Source from the content-addressed store, hash-verified

1378
1379// Verify that adding and deleting all the entries returns an empty list.
1380func TestMultiPartListDelete(t *testing.T) {
1381 size := int(1e4)
1382 ol, commits := createAndDeleteMultiPartList(t, size)
1383 require.Equal(t, size*2, commits)
1384
1385 counter := 0
1386 require.NoError(t, ol.Iterate(math.MaxUint64, 0, func(p *pb.Posting) error {
1387 counter++
1388 return nil
1389 }))
1390 require.Equal(t, 0, counter)
1391
1392 kvs, err := ol.Rollup(nil, math.MaxUint64)
1393 require.NoError(t, err)
1394 require.Equal(t, len(kvs), 1)
1395
1396 for _, kv := range kvs {
1397 require.Equal(t, []byte{BitEmptyPosting}, kv.UserMeta)
1398 require.Equal(t, ol.minTs, kv.Version)
1399 }
1400}
1401
1402// Verify that the first part of a multi-part list is kept even when all its
1403// entries have been deleted. Do this by creating a list, deleting the first

Callers

nothing calls this directly

Calls 3

RollupMethod · 0.80
IterateMethod · 0.45

Tested by

no test coverage detected