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

Function TestMaxPredicateSize

query/query3_test.go:3122–3143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3120}
3121
3122func TestMaxPredicateSize(t *testing.T) {
3123 // Create a string that has more than 2^16 chars.
3124 var b strings.Builder
3125 for i := 0; i < 10000; i++ {
3126 b.WriteString("abcdefg")
3127 }
3128 largePred := b.String()
3129
3130 query := fmt.Sprintf(`
3131 {
3132 me(func: uid(0x2)) {
3133 %s {
3134 name
3135 }
3136 }
3137 }
3138 `, largePred)
3139
3140 _, err := processQuery(context.Background(), t, query)
3141 require.Error(t, err)
3142 require.Contains(t, err.Error(), "Predicate name length cannot be bigger than 2^16")
3143}
3144
3145func TestQueryUnknownType(t *testing.T) {
3146 query := `schema(type: UnknownType) {}`

Callers

nothing calls this directly

Calls 3

processQueryFunction · 0.70
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected