File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,7 @@ func RunAll(t *testing.T) {
848848 t .Run ("multiple operations" , multipleOperations )
849849 t .Run ("query post with author" , queryPostWithAuthor )
850850 t .Run ("queries have extensions" , queriesHaveExtensions )
851+ t .Run ("queries with debug flag have dql query in extensions" , queriesWithDebugFlagHaveDQLQueryInExtensions )
851852 t .Run ("queries have touched_uids even if there are GraphQL errors" , erroredQueriesHaveTouchedUids )
852853 t .Run ("alias works for queries" , queryWithAlias )
853854 t .Run ("multiple aliases for same field in query" , queryWithMultipleAliasOfSameField )
Original file line number Diff line number Diff line change @@ -2097,6 +2097,22 @@ func queriesHaveExtensions(t *testing.T) {
20972097 require .Greater (t , int (gqlResponse .Extensions [touchedUidskey ].(float64 )), 0 )
20982098}
20992099
2100+ func queriesWithDebugFlagHaveDQLQueryInExtensions (t * testing.T ) {
2101+ query := & GraphQLParams {
2102+ Query : `query {
2103+ queryPost {
2104+ title
2105+ }
2106+ }` ,
2107+ }
2108+
2109+ gqlResponse := query .ExecuteAsPost (t , GraphqlURL + "?debug=true" )
2110+ RequireNoGQLErrors (t , gqlResponse )
2111+ require .Contains (t , gqlResponse .Extensions , "dql_query" )
2112+ require .NotEmpty (t , gqlResponse .Extensions ["dql_query" ])
2113+ require .Equal (t , "query {\n queryPost(func: type(Post)) {\n Post.title : Post.title\n dgraph.uid : uid\n }\n }" , gqlResponse .Extensions ["dql_query" ])
2114+ }
2115+
21002116func erroredQueriesHaveTouchedUids (t * testing.T ) {
21012117 country1 := addCountry (t , postExecutor )
21022118 country2 := addCountry (t , postExecutor )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ services:
3737 /gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false; sentry=false;"
3838 --zero=zero1:5080 --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2
3939 --my=alpha1:7080 --security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" --graphql
40- " lambda-url=http://lambda:8686/graphql-worker;" --trace "ratio=1.0;"
40+ " lambda-url=http://lambda:8686/graphql-worker; debug=true; " --trace "ratio=1.0;"
4141
4242 lambda :
4343 image : dgraph/dgraph-lambda:latest
You can’t perform that action at this time.
0 commit comments