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

Function BenchmarkOneLevelQuery

graphql/bench/auth_test.go:220–251  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

218}
219
220func BenchmarkOneLevelQuery(b *testing.B) {
221 schemaFile := "schema_auth.graphql"
222 schema, err := os.ReadFile(schemaFile)
223 require.NoError(b, err)
224
225 metaInfo := getAuthMeta(string(schema))
226 metaInfo.AuthVars = map[string]interface{}{
227 "Role": "ADMIN",
228 "Dish": "Dish",
229 "RName": "Restaurant",
230 "RCurr": "$",
231 }
232
233 query := `
234 query {
235 queryCuisine (first: 300000) {
236 id
237 name
238 }
239 }
240 `
241
242 getUserParams := &common.GraphQLParams{
243 Headers: getJWT(b, metaInfo),
244 Query: query,
245 }
246
247 for i := 0; i < b.N; i++ {
248 gqlResponse := getUserParams.ExecuteAsPost(b, graphqlURL)
249 require.Nilf(b, gqlResponse.Errors, "%+v", gqlResponse.Errors)
250 }
251}
252
253type Cuisine struct {
254 Id string `json:"id,omitempty"`

Callers

nothing calls this directly

Calls 3

ExecuteAsPostMethod · 0.95
getAuthMetaFunction · 0.85
getJWTFunction · 0.85

Tested by

no test coverage detected