Skip to content

Commit

Permalink
Change definition of dgraph.type pred to [string] (#3235)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Apr 2, 2019
1 parent 9c01810 commit 4a41171
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
10 changes: 6 additions & 4 deletions dgraph/cmd/alpha/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ func TestDeletePredicate(t *testing.T) {
`{"predicate":"age","type":"default"},`+
`{"predicate":"name","type":"string","index":true, "tokenizer":["term"]},`+
x.AclPredicates+","+
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"]}`+
`]}}`, output)
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"],
"list":true}]}}`, output)

output, err = runQuery(q1)
require.NoError(t, err)
Expand Down Expand Up @@ -1350,7 +1350,8 @@ func TestListTypeSchemaChange(t *testing.T) {
x.AclPredicates+","+
`{"predicate":"_predicate_","type":"string","list":true},`+
`{"predicate":"occupations","type":"string"},`+
`{"predicate":"dgraph.type", "type":"string", "index":true, "tokenizer": ["exact"]}]}}`, res)
`{"predicate":"dgraph.type", "type":"string", "index":true, "tokenizer": ["exact"],
"list":true}]}}`, res)
}

func TestDeleteAllSP2(t *testing.T) {
Expand Down Expand Up @@ -1507,7 +1508,8 @@ func TestDropAll(t *testing.T) {
z.CompareJSON(t,
`{"data":{"schema":[{"predicate":"_predicate_","type":"string","list":true},`+
x.AclPredicates+","+
`{"predicate":"dgraph.type", "type":"string", "index":true, "tokenizer":["exact"]}]}}`, output)
`{"predicate":"dgraph.type", "type":"string", "index":true, "tokenizer":["exact"],
"list":true}]}}`, output)

// Reinstate schema so that we can re-run the original query.
err = alterSchemaWithRetry(s)
Expand Down
2 changes: 2 additions & 0 deletions query/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ func populateCluster() {
<3> <dgraph.type> "Person" .
<4> <dgraph.type> "Person" .
<5> <dgraph.type> "Animal" .
<5> <dgraph.type> "Pet" .
<6> <dgraph.type> "Animal" .
<6> <dgraph.type> "Pet" .
<2> <pet> <5> .
<3> <pet> <6> .
Expand Down
1 change: 1 addition & 0 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ func InitialSchema() []*pb.SchemaUpdate {
ValueType: pb.Posting_STRING,
Directive: pb.SchemaUpdate_INDEX,
Tokenizer: []string{"exact"},
List: true,
})

if x.WorkerConfig.AclEnabled {
Expand Down
6 changes: 4 additions & 2 deletions systest/mutations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ func SchemaAfterDeleteNode(t *testing.T, c *dgo.Dgraph) {
`{"predicate":"friend","type":"uid","list":true},`+
`{"predicate":"married","type":"bool"},`+
`{"predicate":"name","type":"default"},`+
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"]}]`),
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"],
"list":true}]`),
string(resp.Json))

require.NoError(t, c.Alter(ctx, &api.Operation{DropAttr: "married"}))
Expand All @@ -706,7 +707,8 @@ func SchemaAfterDeleteNode(t *testing.T, c *dgo.Dgraph) {
`{"predicate":"_predicate_","type":"string","list":true},`+
`{"predicate":"friend","type":"uid","list":true},`+
`{"predicate":"name","type":"default"},`+
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"]}]`),
`{"predicate":"dgraph.type","type":"string","index":true, "tokenizer":["exact"],
"list":true}]`),
string(resp.Json))
}

Expand Down
6 changes: 4 additions & 2 deletions systest/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ func SchemaQueryTest(t *testing.T, c *dgo.Dgraph) {
"index": true,
"tokenizer": [
"exact"
]
],
"list": true
},
{
"predicate": "name",
Expand Down Expand Up @@ -535,7 +536,8 @@ func SchemaQueryTestHTTP(t *testing.T, c *dgo.Dgraph) {
"index": true,
"predicate": "dgraph.type",
"type": "string",
"tokenizer": ["exact"]
"tokenizer": ["exact"],
"list": true
},
{
"predicate": "name",
Expand Down

0 comments on commit 4a41171

Please sign in to comment.