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

Function TestCountIndexOverwrite

worker/worker_test.go:386–406  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

384}
385
386func TestCountIndexOverwrite(t *testing.T) {
387 schemaStr := "friend: [uid] @reverse @count ."
388 dg, err := testutil.DgraphClient(testutil.GetSockAddr())
389 if err != nil {
390 t.Fatalf("Error while getting a dgraph client: %v", err)
391 }
392 testutil.DropAll(t, dg)
393
394 require.NoError(t, dg.Alter(context.Background(), &api.Operation{Schema: schemaStr}))
395
396 for i := 0; i < 1000; i++ {
397 setClusterEdge(t, dg, fmt.Sprintf("<%#x> <friend> <%#x> .", 1, 2))
398 }
399 resp, err := runQuery(
400 dg,
401 "count(friend)",
402 nil,
403 []string{"eq", "", "1"})
404 require.Equal(
405 t, string(resp.Json), `{"q":[{"uid":"0x1"}]}`)
406}
407
408func TestCountReverseWithDeletes(t *testing.T) {
409 schemaStr := "friend: [uid] @reverse @count ."

Callers

nothing calls this directly

Calls 7

DgraphClientFunction · 0.92
GetSockAddrFunction · 0.92
DropAllFunction · 0.92
FatalfMethod · 0.80
AlterMethod · 0.80
setClusterEdgeFunction · 0.70
runQueryFunction · 0.70

Tested by

no test coverage detected