File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
main/java/io/confluent/kafka/connect/datagen
test/java/io/confluent/kafka/connect/datagen Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public class DatagenConnectorConfig extends AbstractConfig {
51
51
+ "Each task will generate different data than the other tasks in the same connector." ;
52
52
public static final String GENERATE_TIMEOUT_CONF = "generate.timeout" ;
53
53
private static final String GENERATE_TIMEOUT_DOC = "Timeout in milliseconds for random message "
54
- + "generation" ;
54
+ + "generation. This timeout can be configured for upto 1 minute, i.e 60000ms " ;
55
55
56
56
public DatagenConnectorConfig (ConfigDef config , Map <String , String > parsedConfig ) {
57
57
super (config , parsedConfig );
Original file line number Diff line number Diff line change @@ -220,6 +220,30 @@ public void shouldNotValidateSchemaKeyFieldWhenMultipleSchemaSourcesAreSet() {
220
220
);
221
221
}
222
222
223
+ @ Test
224
+ public void shouldAllowSettingGenerateTimeoutInRange () {
225
+ clearSchemaSources ();
226
+ config .put (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF , "100" );
227
+ Config validated = connector .validate (config );
228
+ assertThat (validated , hasNoValidationErrorsFor (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF ));
229
+ }
230
+
231
+ @ Test
232
+ public void shouldNotAllowSettingGenerateTimeoutNegative () {
233
+ clearSchemaSources ();
234
+ config .put (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF , "-1" );
235
+ Config validated = connector .validate (config );
236
+ assertThat (validated , hasValidationError (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF , 1 ));
237
+ }
238
+
239
+ @ Test
240
+ public void shouldNotAllowSettingGenerateTimeoutOutOfRange () {
241
+ clearSchemaSources ();
242
+ config .put (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF , "70000" );
243
+ Config validated = connector .validate (config );
244
+ assertThat (validated , hasValidationError (DatagenConnectorConfig .GENERATE_TIMEOUT_CONF , 1 ));
245
+ }
246
+
223
247
protected void assertTaskConfigs (int maxTasks ) {
224
248
List <Map <String , String >> taskConfigs = connector .taskConfigs (maxTasks );
225
249
assertEquals (maxTasks , taskConfigs .size ());
You can’t perform that action at this time.
0 commit comments