You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2020/03/11 06:01:50 UTC
[incubator-pinot] branch master updated: Add test for
RealtimeSegmentSelector for no segment scenario (#5139)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 5c7ece2 Add test for RealtimeSegmentSelector for no segment scenario (#5139)
5c7ece2 is described below
commit 5c7ece2ba85e93c221ce11697b87e35a7a8b99de
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Tue Mar 10 23:01:41 2020 -0700
Add test for RealtimeSegmentSelector for no segment scenario (#5139)
---
.../broker/routing/segmentselector/SegmentSelectorTest.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorTest.java
index cc798aa..5b89b88 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorTest.java
@@ -62,6 +62,12 @@ public class SegmentSelectorTest {
Map<String, String> consumingInstanceStateMap = Collections.singletonMap("server", CONSUMING);
Set<String> onlineSegments = new HashSet<>();
+ // Should return an empty list when there is no segment
+ RealtimeSegmentSelector segmentSelector = new RealtimeSegmentSelector();
+ segmentSelector.init(externalView, onlineSegments);
+ BrokerRequest brokerRequest = mock(BrokerRequest.class);
+ assertTrue(segmentSelector.select(brokerRequest).isEmpty());
+
// For HLC segments, only one group of segments should be selected
int numHLCGroups = 3;
int numHLCSegmentsPerGroup = 5;
@@ -77,12 +83,9 @@ public class SegmentSelectorTest {
}
hlcSegments[i] = hlcSegmentsForGroup;
}
-
- RealtimeSegmentSelector segmentSelector = new RealtimeSegmentSelector();
- segmentSelector.init(externalView, onlineSegments);
+ segmentSelector.onExternalViewChange(externalView, onlineSegments);
// Only HLC segments exist, should select the HLC segments from the first group
- BrokerRequest brokerRequest = mock(BrokerRequest.class);
assertEqualsNoOrder(segmentSelector.select(brokerRequest).toArray(), hlcSegments[0]);
// For LLC segments, only the first CONSUMING segment for each partition should be selected
@@ -104,7 +107,6 @@ public class SegmentSelectorTest {
}
}
}
-
segmentSelector.onExternalViewChange(externalView, onlineSegments);
// Both HLC and LLC segments exist, should select the LLC segments
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org