(t *testing.T, schemaStr string)
| 122 | } |
| 123 | |
| 124 | func initTestExport(t *testing.T, schemaStr string) { |
| 125 | require.NoError(t, schema.ParseBytes([]byte(schemaStr), 1)) |
| 126 | |
| 127 | val, err := proto.Marshal(&pb.SchemaUpdate{ValueType: pb.Posting_UID}) |
| 128 | require.NoError(t, err) |
| 129 | |
| 130 | txn := pstore.NewTransactionAt(math.MaxUint64, true) |
| 131 | require.NoError(t, txn.Set(testutil.RootNsSchemaKey("friend"), val)) |
| 132 | // Schema is always written at timestamp 1 |
| 133 | require.NoError(t, txn.CommitAt(1, nil)) |
| 134 | |
| 135 | require.NoError(t, err) |
| 136 | val, err = proto.Marshal(&pb.SchemaUpdate{ValueType: pb.Posting_UID}) |
| 137 | require.NoError(t, err) |
| 138 | |
| 139 | txn = pstore.NewTransactionAt(math.MaxUint64, true) |
| 140 | require.NoError(t, txn.Set(testutil.RootNsSchemaKey("http://www.w3.org/2000/01/rdf-schema#range"), val)) |
| 141 | require.NoError(t, txn.Set(testutil.RootNsSchemaKey("friend_not_served"), val)) |
| 142 | require.NoError(t, txn.Set(testutil.RootNsSchemaKey("age"), val)) |
| 143 | require.NoError(t, txn.CommitAt(1, nil)) |
| 144 | |
| 145 | val, err = proto.Marshal(personType) |
| 146 | require.NoError(t, err) |
| 147 | |
| 148 | txn = pstore.NewTransactionAt(math.MaxUint64, true) |
| 149 | require.NoError(t, txn.Set(testutil.RootNsTypeKey("Person"), val)) |
| 150 | require.NoError(t, txn.CommitAt(1, nil)) |
| 151 | |
| 152 | populateGraphExport(t) |
| 153 | |
| 154 | // Drop age predicate after populating DB. |
| 155 | // age should not exist in the exported schema. |
| 156 | txn = pstore.NewTransactionAt(math.MaxUint64, true) |
| 157 | require.NoError(t, txn.Delete(testutil.RootNsSchemaKey("age"))) |
| 158 | require.NoError(t, txn.CommitAt(1, nil)) |
| 159 | } |
| 160 | |
| 161 | func getExportFileList(t *testing.T, bdir string) (dataFiles, schemaFiles, gqlSchema []string) { |
| 162 | searchDir := bdir |
no test coverage detected