@@ -261,4 +261,60 @@ public void testAuthInclusion() throws Exception {
261261 new HashSet <>(Arrays .asList ("admin," , "test," )));
262262 }
263263 }
264+
265+ @ Test
266+ public void testTimeSeriesInclusion () throws Exception {
267+ final DataNodeWrapper receiverDataNode = receiverEnv .getDataNodeWrapper (0 );
268+
269+ final String receiverIp = receiverDataNode .getIp ();
270+ final int receiverPort = receiverDataNode .getPort ();
271+
272+ try (final SyncConfigNodeIServiceClient client =
273+ (SyncConfigNodeIServiceClient ) senderEnv .getLeaderConfigNodeConnection ()) {
274+
275+ // Do not fail if the failure has nothing to do with pipe
276+ // Because the failures will randomly generate due to resource limitation
277+ if (!TestUtils .tryExecuteNonQueriesWithRetry (
278+ senderEnv ,
279+ Arrays .asList (
280+ "create database root.sg" ,
281+ "create timeseries root.sg.a.b int32" ,
282+ "create aligned timeseries root.sg.`apache|timecho-tag-attr`.d1(s1 INT32 tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2), s2 DOUBLE tags(tag3=v3, tag4=v4) attributes(attr3=v3, attr4=v4))" ))) {
283+ return ;
284+ }
285+
286+ final Map <String , String > extractorAttributes = new HashMap <>();
287+ final Map <String , String > processorAttributes = new HashMap <>();
288+ final Map <String , String > connectorAttributes = new HashMap <>();
289+
290+ extractorAttributes .put ("extractor.inclusion" , "schema" );
291+
292+ connectorAttributes .put ("connector" , "iotdb-thrift-connector" );
293+ connectorAttributes .put ("connector.ip" , receiverIp );
294+ connectorAttributes .put ("connector.port" , Integer .toString (receiverPort ));
295+ connectorAttributes .put ("connector.exception.conflict.resolve-strategy" , "retry" );
296+ connectorAttributes .put ("connector.exception.conflict.retry-max-time-seconds" , "-1" );
297+
298+ final TSStatus status =
299+ client .createPipe (
300+ new TCreatePipeReq ("testPipe" , connectorAttributes )
301+ .setExtractorAttributes (extractorAttributes )
302+ .setProcessorAttributes (processorAttributes ));
303+
304+ Assert .assertEquals (TSStatusCode .SUCCESS_STATUS .getStatusCode (), status .getCode ());
305+
306+ Assert .assertEquals (
307+ TSStatusCode .SUCCESS_STATUS .getStatusCode (), client .startPipe ("testPipe" ).getCode ());
308+
309+ TestUtils .assertDataEventuallyOnEnv (
310+ receiverEnv ,
311+ "show timeseries" ,
312+ "Timeseries,Alias,Database,DataType,Encoding,Compression,Tags,Attributes,Deadband,DeadbandParameters,ViewType," ,
313+ new HashSet <>(
314+ Arrays .asList (
315+ "root.sg.a.b,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE," ,
316+ "root.sg.`apache|timecho-tag-attr`.d1.s1,null,root.sg,INT32,TS_2DIFF,LZ4,{\" tag1\" :\" v1\" ,\" tag2\" :\" v2\" },{\" attr2\" :\" v2\" ,\" attr1\" :\" v1\" },null,null,BASE," ,
317+ "root.sg.`apache|timecho-tag-attr`.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,{\" tag4\" :\" v4\" ,\" tag3\" :\" v3\" },{\" attr4\" :\" v4\" ,\" attr3\" :\" v3\" },null,null,BASE," )));
318+ }
319+ }
264320}
0 commit comments