tibrewalpratik17 commented on code in PR #14228:
URL: https://github.com/apache/pinot/pull/14228#discussion_r1808445138
##########
pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java:
##########
@@ -662,6 +665,58 @@ 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,
+ () ->
_helixResourceManager.validateTableTaskMinionInstanceTagConfig(realtimeTableConfig));
+
+ // 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,
Review Comment:
nit: let's also assert the exception message here
--
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]