Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.1.1
-
None
-
None
Description
Test case
Perform validation of a custom connector that defines ConfigDef with undefined dependent configs, i.e. it uses ConfigDef.define() method where the config that is specified in dependents argument is missing in this ConfigDef.
AR: validation successful
ER: validation failed with the error: Configuration is not defined
Description
There are two places where undefined configs can be obtained:
- The undefined dependent configs can be returned here: AbstractHerder.validateBasicConnectorConfig() -> ConfigDef.validateAll()
List<String> undefinedConfigKeys = undefinedDependentConfigs(); for (String undefinedConfigKey: undefinedConfigKeys) { ConfigValue undefinedConfigValue = new ConfigValue(undefinedConfigKey); undefinedConfigValue.addErrorMessage(undefinedConfigKey + " is referred in the dependents, but not defined."); undefinedConfigValue.visible(false); configValues.put(undefinedConfigKey, undefinedConfigValue); }
- The undefined configs can be returned by custom code here: Connector.validate()
AbstractHerder.generateResult() method already contains the check for undefined configs, but it doesn't increase errorCount variable
int errorCount = 0; List<ConfigInfo> configInfoList = new LinkedList<>(); Map<String, ConfigValue> configValueMap = new HashMap<>(); for (ConfigValue configValue: configValues) { String configName = configValue.name(); configValueMap.put(configName, configValue); if (!configKeys.containsKey(configName)) { configValue.addErrorMessage("Configuration is not defined: " + configName); configInfoList.add(new ConfigInfo(null, convertConfigValue(configValue, null))); } }
so Kafka Connect validation ignores the errors.
I suggest to add the following code after adding of the error message:
errorCount += configValue.errorMessages().size();
Attachments
Issue Links
- is fixed by
-
KAFKA-10600 Connect adds error to property in validation result if connector does not define the property
-
- Resolved
-