(t *testing.T)
| 296 | } |
| 297 | |
| 298 | func TestCountReverseIndexEmptyPosting(t *testing.T) { |
| 299 | require.NoError(t, pstore.DropAll()) |
| 300 | MemLayerInstance.clear() |
| 301 | indexNameCountVal := "testcount: [uid] @count @reverse ." |
| 302 | |
| 303 | attr := x.AttrInRootNamespace("testcount") |
| 304 | addDelEdgeToUID(t, attr, 1, 23, uint64(10), uint64(11)) |
| 305 | l, err := GetNoStore(x.DataKey(attr, 1), 12) |
| 306 | require.NoError(t, err) |
| 307 | l.RLock() |
| 308 | require.Equal(t, l.GetLength(12), -1) |
| 309 | l.RUnlock() |
| 310 | |
| 311 | require.NoError(t, schema.ParseBytes([]byte(indexNameCountVal), 1)) |
| 312 | currentSchema, _ := schema.State().Get(context.Background(), attr) |
| 313 | rb := IndexRebuild{ |
| 314 | Attr: attr, |
| 315 | StartTs: 12, |
| 316 | OldSchema: nil, |
| 317 | CurrentSchema: ¤tSchema, |
| 318 | } |
| 319 | rebuildInfo := rb.needsTokIndexRebuild() |
| 320 | prefixes, err := rebuildInfo.prefixesForTokIndexes() |
| 321 | require.NoError(t, err) |
| 322 | require.NoError(t, pstore.DropPrefix(prefixes...)) |
| 323 | require.NoError(t, rebuildCountIndex(context.Background(), &rb)) |
| 324 | |
| 325 | l, err = GetNoStore(x.DataKey(attr, 1), 14) |
| 326 | require.NoError(t, err) |
| 327 | l.RLock() |
| 328 | require.Equal(t, l.GetLength(14), 0) |
| 329 | l.RUnlock() |
| 330 | } |
| 331 | |
| 332 | func TestRebuildTokIndex(t *testing.T) { |
| 333 | addEdgeToValue(t, x.AttrInRootNamespace("name2"), 91, "Michonne", uint64(1), uint64(2)) |
nothing calls this directly
no test coverage detected