(t *testing.T)
| 280 | } |
| 281 | |
| 282 | func TestFanInPartitioningMutations(t *testing.T) { |
| 283 | sourceParams := "{\"numPartitions\":3}" |
| 284 | planParams := cbgt.PlanParams{ |
| 285 | MaxPartitionsPerPIndex: 2, |
| 286 | } |
| 287 | expectedNumPIndexes := 2 |
| 288 | expectedNumStreamsEntries := 3 |
| 289 | |
| 290 | testPartitioning(t, sourceParams, planParams, |
| 291 | expectedNumPIndexes, expectedNumStreamsEntries, |
| 292 | func(mgr *cbgt.Manager, sf *cbgt.PrimaryFeed, |
| 293 | pindexes map[string]*cbgt.PIndex) { |
| 294 | var pindex0_0 *cbgt.PIndex |
| 295 | var pindex0_1 *cbgt.PIndex |
| 296 | var pindex1 *cbgt.PIndex |
| 297 | for _, pindex := range pindexes { |
| 298 | if strings.Contains(pindex.SourcePartitions, "0") { |
| 299 | pindex0_0 = pindex |
| 300 | } |
| 301 | if strings.Contains(pindex.SourcePartitions, "1") { |
| 302 | pindex0_1 = pindex |
| 303 | } |
| 304 | if pindex.SourcePartitions == "2" { |
| 305 | pindex1 = pindex |
| 306 | } |
| 307 | } |
| 308 | if pindex0_0 == nil || pindex0_1 == nil { |
| 309 | t.Errorf("expected pindex0_0/1") |
| 310 | } |
| 311 | if pindex0_0 != pindex0_1 { |
| 312 | t.Errorf("expected pindex0 equality") |
| 313 | } |
| 314 | if pindex1 == nil { |
| 315 | t.Errorf("expected pindex1") |
| 316 | } |
| 317 | bindex0, ok := pindex0_0.Impl.(bleve.Index) |
| 318 | if !ok || bindex0 == nil { |
| 319 | t.Errorf("expected bleve.Index") |
| 320 | } |
| 321 | bindex1, ok := pindex1.Impl.(bleve.Index) |
| 322 | if !ok || bindex1 == nil { |
| 323 | t.Errorf("expected bleve.Index") |
| 324 | } |
| 325 | n, err := bindex0.DocCount() |
| 326 | if err != nil { |
| 327 | t.Errorf("error getting doc count: %v", err) |
| 328 | } |
| 329 | if n != 0 { |
| 330 | t.Errorf("expected 0 docs in bindex0, got: %d", n) |
| 331 | } |
| 332 | n, err = bindex1.DocCount() |
| 333 | if err != nil { |
| 334 | t.Errorf("error getting doc count: %v", err) |
| 335 | } |
| 336 | if n != 0 { |
| 337 | t.Errorf("expected 0 docs in bindex1, got: %d", n) |
| 338 | } |
| 339 |
nothing calls this directly
no test coverage detected