tibrewalpratik17 commented on code in PR #14228:
URL: https://github.com/apache/pinot/pull/14228#discussion_r1808510006
##########
pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java:
##########
@@ -662,6 +665,73 @@ public void testValidateTenantConfig() {
resetServerTags();
}
+ @Test
+ public void testValidateTableTaskMinionInstanceTagConfig() {
+ TableConfig realtimeTableConfig = new
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).build();
+
+ Map<String, String> segmentGenerationAndPushTaskConfig =
+ Map.of("invalidRecordsThresholdCount", "1", "schedule", "0 */30 * ? *
*", "tableMaxNumTasks", "1",
+ "validDocIdsType", "SNAPSHOT");
+
+ Map<String, String> upsertCompactionTask =
+ Map.of("invalidRecordsThresholdCount", "1", "schedule", "0 */30 * ? *
*", "tableMaxNumTasks", "1",
+ "validDocIdsType", "SNAPSHOT", "minionInstanceTag",
"minionTenant");
+
+ Map<String, String> segmentGenerationAndPushTaskConfig2 =
+ Map.of("schedule", "0 */30 * ? * *", "tableMaxNumTasks", "1",
"validDocIdsType", "SNAPSHOT",
+ "minionInstanceTag", "anotherMinionTenant");
+
+ // Minion instance tag set but no minion present
+ realtimeTableConfig.setTaskConfig(new TableTaskConfig(
+
ImmutableMap.of(MinionConstants.RealtimeToOfflineSegmentsTask.TASK_TYPE,
upsertCompactionTask)));
+
+ assertThrows(InvalidTableConfigException.class, () -> {
+ try {
+
_helixResourceManager.validateTableTaskMinionInstanceTagConfig(realtimeTableConfig);
+ } catch (InvalidTableConfigException e) {
+ assertEquals(e.getMessage(),
+ "Failed to find minion instances with tag: minionTenant for table:
testTable_REALTIME");
+ throw e;
+ }
+ });
+
+ // Valid minion instance tag with instances
+ addMinionInstance();
+
_helixResourceManager.validateTableTaskMinionInstanceTagConfig(realtimeTableConfig);
+
+ //Untag minion instance
+ untagMinions();
+ realtimeTableConfig.setTaskConfig(new TableTaskConfig(
+
ImmutableMap.of(MinionConstants.RealtimeToOfflineSegmentsTask.TASK_TYPE,
segmentGenerationAndPushTaskConfig)));
+
_helixResourceManager.validateTableTaskMinionInstanceTagConfig(realtimeTableConfig);
+
+ realtimeTableConfig.setTaskConfig(new TableTaskConfig(
+
ImmutableMap.of(MinionConstants.RealtimeToOfflineSegmentsTask.TASK_TYPE,
segmentGenerationAndPushTaskConfig2)));
+ assertThrows(InvalidTableConfigException.class, () -> {
+ try {
+
_helixResourceManager.validateTableTaskMinionInstanceTagConfig(realtimeTableConfig);
+ } catch (InvalidTableConfigException e) {
+ assertEquals(e.getMessage(),
+ "Failed to find minion instances with tag: anotherMinionTenant for
table: testTable_REALTIME");
+ throw e;
+ }
Review Comment:
Discussed offline, this will be handled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]