add index
(t *testing.T)
| 413 | |
| 414 | // add index |
| 415 | func TestSchemaMutationIndexAdd(t *testing.T) { |
| 416 | var q1 = ` |
| 417 | { |
| 418 | user(func:anyofterms(name, "Alice")) { |
| 419 | name |
| 420 | } |
| 421 | } |
| 422 | ` |
| 423 | var m = ` |
| 424 | { |
| 425 | set { |
| 426 | # comment line should be ignored |
| 427 | <0x1> <name> "Alice" . |
| 428 | } |
| 429 | } |
| 430 | ` |
| 431 | |
| 432 | var s = ` |
| 433 | name:string @index(term) . |
| 434 | ` |
| 435 | |
| 436 | // reset Schema |
| 437 | require.NoError(t, schema.ParseBytes([]byte(""), 1)) |
| 438 | require.NoError(t, runMutation(m)) |
| 439 | |
| 440 | // add index to name |
| 441 | require.NoError(t, alterSchemaWithRetry(s)) |
| 442 | |
| 443 | output, err := runGraphqlQuery(q1) |
| 444 | require.NoError(t, err) |
| 445 | require.JSONEq(t, `{"data": {"user":[{"name":"Alice"}]}}`, output) |
| 446 | |
| 447 | } |
| 448 | |
| 449 | // Remove index |
| 450 | func TestSchemaMutationIndexRemove(t *testing.T) { |
nothing calls this directly
no test coverage detected