(t *testing.T)
| 419 | } |
| 420 | |
| 421 | func TestDropPredicate(t *testing.T) { |
| 422 | // Add new predicate with several indices. |
| 423 | s1 := testSchema + "\n numerology: string @index(term) .\n" |
| 424 | setSchema(s1) |
| 425 | triples := ` |
| 426 | <0x666> <numerology> "This number is evil" . |
| 427 | <0x777> <numerology> "This number is good" . |
| 428 | ` |
| 429 | require.NoError(t, addTriplesToCluster(triples)) |
| 430 | |
| 431 | // Verify queries work as expected. |
| 432 | q1 := ` |
| 433 | { |
| 434 | me(func: anyofterms(numerology, "number")) { |
| 435 | uid |
| 436 | numerology |
| 437 | } |
| 438 | }` |
| 439 | js := processQueryNoErr(t, q1) |
| 440 | require.JSONEq(t, `{"data": {"me": [ |
| 441 | {"uid": "0x666", "numerology": "This number is evil"}, |
| 442 | {"uid": "0x777", "numerology": "This number is good"} |
| 443 | ]}}`, js) |
| 444 | |
| 445 | // Finally, drop the predicate and verify the query no longer works because |
| 446 | // the index was dropped when all the data for that predicate was deleted. |
| 447 | dropPredicate("numerology") |
| 448 | _, err := processQuery(context.Background(), t, q1) |
| 449 | require.Error(t, err) |
| 450 | require.Contains(t, err.Error(), "Attribute numerology is not indexed with type term") |
| 451 | |
| 452 | // Finally, restore the schema. |
| 453 | setSchema(testSchema) |
| 454 | } |
| 455 | |
| 456 | func TestNestedExpandAll(t *testing.T) { |
| 457 | query := `{ |
nothing calls this directly
no test coverage detected