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

Function populateCluster

query/common_test.go:355–1010  ·  view source on GitHub ↗
(dc dgraphapi.Cluster)

Source from the content-addressed store, hash-verified

353const ngramVersionHash = "d7dfe3b4282fa3543e811c5538f86d39268961ba"
354
355func populateCluster(dc dgraphapi.Cluster) {
356 x.Panic(client.Alter(context.Background(), &api.Operation{DropAll: true}))
357
358 // In the query package, we test using hard coded UIDs so that we know what results
359 // to expect. We need to move the max assigned UID in zero to higher value than
360 // all the UIDs we are using during the tests.
361 x.Panic(dc.AssignUids(client.Dgraph, 65536))
362
363 // higher, err := dgraphtest.IsHigherVersion(dc.GetVersion(), "160a0faa5fc6233fdc5a4caa4a7a3d1591f460d0")
364 // x.Panic(err)
365 // var ts string
366 // if higher {
367 // ts = testSchema + `type User {
368 // name
369 // password
370 // gender
371 // friend
372 // alive
373 // user_profile
374 // }
375 // user_profile : float32vector @index(hnsw(metric:"euclidean")) .`
376 // } else {
377 // ts = testSchema + `type User {
378 // name
379 // password
380 // gender
381 // friend
382 // alive
383 // }`
384 // }
385
386 // Ngram indexing handling
387 ngramSupport, err := dgraphtest.IsHigherVersion(dc.GetVersion(), ngramVersionHash)
388 x.Panic(err)
389 if ngramSupport {
390 testSchema += "\ndescription: string @index(ngram) ."
391 }
392
393 setSchema(testSchema)
394
395 err = addTriplesToCluster(`
396 <1> <name> "Michonne" .
397 <2> <name> "King Lear" .
398 <3> <name> "Margaret" .
399 <4> <name> "Leonard" .
400 <5> <name> "Garfield" .
401 <6> <name> "Bear" .
402 <7> <name> "Nemo" .
403 <11> <name> "name" .
404 <23> <name> "Rick Grimes" .
405 <24> <name> "Glenn Rhee" .
406 <25> <name> "Daryl Dixon" .
407 <31> <name> "Andrea" .
408 <33> <name> "San Mateo High School" .
409 <34> <name> "San Mateo School District" .
410 <35> <name> "San Mateo County" .
411 <36> <name> "California" .
412 <110> <name> "Alice" .

Callers 3

TestMainFunction · 0.70
TestMainFunction · 0.70
TestMainFunction · 0.70

Calls 10

PanicFunction · 0.92
IsHigherVersionFunction · 0.92
addGeoPointToClusterFunction · 0.85
addGeoPolygonToClusterFunction · 0.85
AlterMethod · 0.80
setSchemaFunction · 0.70
addTriplesToClusterFunction · 0.70
AssignUidsMethod · 0.65
GetVersionMethod · 0.65

Tested by

no test coverage detected