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

Function DgraphClientWithGroot

testutil/client.go:312–331  ·  view source on GitHub ↗

DgraphClientWithGroot creates a Dgraph client with groot permissions set up. It is intended to be called from TestMain() to establish a Dgraph connection shared by all tests, so there is no testing.T instance for it to use.

(serviceAddr string)

Source from the content-addressed store, hash-verified

310// It is intended to be called from TestMain() to establish a Dgraph connection shared
311// by all tests, so there is no testing.T instance for it to use.
312func DgraphClientWithGroot(serviceAddr string) (*dgo.Dgraph, error) {
313 dg, err := DgraphClient(serviceAddr)
314 if err != nil {
315 return nil, err
316 }
317
318 ctx := context.Background()
319 for {
320 // keep retrying until we succeed or receive a non-retriable error
321 err = dg.LoginIntoNamespace(ctx, x.GrootId, "password", x.RootNamespace)
322 if err == nil || !(strings.Contains(err.Error(), "Please retry") ||
323 strings.Contains(err.Error(), "user not found")) {
324
325 break
326 }
327 time.Sleep(time.Second)
328 }
329
330 return dg, err
331}
332
333// DgraphClient creates a Dgraph client.
334// It is intended to be called from TestMain() to establish a Dgraph connection shared

Callers 10

setupFunction · 0.92
TestMainFunction · 0.92
TestMainFunction · 0.92
TestLivePasswordFunction · 0.92
runBenchmarkFunction · 0.92
TestParallelIndexingFunction · 0.92
TestReverseIndexFunction · 0.92
TestStringIndexFunction · 0.92
TestCountIndexFunction · 0.92
safelyDropAllFunction · 0.92

Calls 3

DgraphClientFunction · 0.85
LoginIntoNamespaceMethod · 0.80
ErrorMethod · 0.45

Tested by 8

setupFunction · 0.74
TestMainFunction · 0.74
TestMainFunction · 0.74
TestLivePasswordFunction · 0.74
TestParallelIndexingFunction · 0.74
TestReverseIndexFunction · 0.74
TestStringIndexFunction · 0.74
TestCountIndexFunction · 0.74