MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / TestSchemaMutationIndexRemove

Function TestSchemaMutationIndexRemove

dgraph/cmd/alpha/run_test.go:450–489  ·  view source on GitHub ↗

Remove index

(t *testing.T)

Source from the content-addressed store, hash-verified

448
449// Remove index
450func TestSchemaMutationIndexRemove(t *testing.T) {
451 var q1 = `
452 {
453 user(func:anyofterms(name, "Alice")) {
454 name
455 }
456 }
457 `
458 var m = `
459 {
460 set {
461 # comment line should be ignored
462 <0x1> <name> "Alice" .
463 }
464 }
465 `
466
467 var s1 = `
468 name:string @index(term) .
469 `
470 var s2 = `
471 name:string .
472 `
473
474 // reset Schema
475 require.NoError(t, schema.ParseBytes([]byte(""), 1))
476 // add index to name
477 require.NoError(t, alterSchemaWithRetry(s1))
478 require.NoError(t, runMutation(m))
479
480 output, err := runGraphqlQuery(q1)
481 require.NoError(t, err)
482 require.JSONEq(t, `{"data": {"user":[{"name":"Alice"}]}}`, output)
483
484 // remove index
485 require.NoError(t, alterSchemaWithRetry(s2))
486
487 _, err = runGraphqlQuery(q1)
488 require.Error(t, err)
489}
490
491// add reverse edge
492func TestSchemaMutationReverseAdd(t *testing.T) {

Callers

nothing calls this directly

Calls 5

ParseBytesFunction · 0.92
alterSchemaWithRetryFunction · 0.85
runGraphqlQueryFunction · 0.85
runMutationFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…