Skip to content

Commit 5bb6803

Browse files
authored
Pipe: Implemented runtime permission check (#14885)
1 parent ea43227 commit 5bb6803

File tree

85 files changed

+2297
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2297
-167
lines changed

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/TableModelUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ public static boolean hasDataBase(final String database, final BaseEnv baseEnv)
400400
return true;
401401
}
402402

403+
public static void assertCountDataAlwaysOnEnv(
404+
final String database, final String table, final int count, final BaseEnv baseEnv) {
405+
TestUtils.assertDataAlwaysOnEnv(
406+
baseEnv, getQueryCountSql(table), "_col0,", Collections.singleton(count + ","), database);
407+
}
408+
403409
public static void assertCountData(
404410
final String database, final String table, final int count, final BaseEnv baseEnv) {
405411
TestUtils.assertDataEventuallyOnEnv(

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeDataSinkIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public void testThriftConnectorWithRealtimeFirstDisabled() throws Exception {
9090
extractorAttributes.put("extractor.realtime.mode", "log");
9191
extractorAttributes.put("capture.table", "true");
9292
extractorAttributes.put("capture.tree", "true");
93+
extractorAttributes.put("user", "root");
9394

9495
connectorAttributes.put("connector", "iotdb-thrift-connector");
9596
connectorAttributes.put("connector.batch.enable", "true");
@@ -171,6 +172,7 @@ private void testSinkFormat(final String format) throws Exception {
171172

172173
extractorAttributes.put("capture.table", "true");
173174
extractorAttributes.put("capture.tree", "true");
175+
extractorAttributes.put("user", "root");
174176

175177
connectorAttributes.put("connector", "iotdb-thrift-connector");
176178
connectorAttributes.put("connector.batch.enable", "true");
@@ -261,11 +263,13 @@ public void testWriteBackSink() throws Exception {
261263
extractorAttributes.put("forwarding-pipe-requests", "false");
262264
extractorAttributes.put("extractor.database-name", "test.*");
263265
extractorAttributes.put("extractor.table-name", "test.*");
266+
extractorAttributes.put("user", "root");
264267

265268
processorAttributes.put("processor", "rename-database-processor");
266269
processorAttributes.put("processor.new-db-name", "Test1");
267270

268271
connectorAttributes.put("connector", "write-back-sink");
272+
connectorAttributes.put("user", "root");
269273

270274
final TSStatus status =
271275
client.createPipe(
@@ -377,6 +381,7 @@ private void doTest(BiConsumer<Map<String, List<Tablet>>, Map<String, List<Table
377381
extractorAttributes.put("capture.tree", "true");
378382
extractorAttributes.put("extractor.database-name", "test.*");
379383
extractorAttributes.put("extractor.table-name", "test.*");
384+
extractorAttributes.put("user", "root");
380385

381386
connectorAttributes.put("connector", "iotdb-thrift-connector");
382387
connectorAttributes.put("connector.ip", receiverIp);
@@ -734,6 +739,7 @@ public void testLoadTsFileWithoutVerify() throws Exception {
734739
extractorAttributes.put("extractor.realtime.mode", "batch");
735740
extractorAttributes.put("capture.table", "true");
736741
extractorAttributes.put("capture.tree", "true");
742+
extractorAttributes.put("user", "root");
737743

738744
connectorAttributes.put("sink", "iotdb-thrift-sink");
739745
connectorAttributes.put("sink.batch.enable", "false");

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeExtractorIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public void testMatchingMultipleDatabases() throws Exception {
111111
extractorAttributes.put("extractor.table-name", "test");
112112
extractorAttributes.put("extractor.pattern", "root.db1");
113113
extractorAttributes.put("extractor.inclusion", "data.insert");
114+
extractorAttributes.put("user", "root");
114115

115116
connectorAttributes.put("connector", "iotdb-thrift-connector");
116117
connectorAttributes.put("connector.batch.enable", "false");
@@ -264,6 +265,7 @@ public void testHistoryAndRealtime() throws Exception {
264265
extractorAttributes.put("extractor.pattern", "root.db.d2");
265266
extractorAttributes.put("extractor.history.enable", "false");
266267
extractorAttributes.put("extractor.realtime.enable", "true");
268+
extractorAttributes.put("user", "root");
267269
TSStatus status =
268270
client.createPipe(
269271
new TCreatePipeReq("p2", connectorAttributes)
@@ -401,6 +403,7 @@ public void testHistoryStartTimeAndEndTimeWorkingWithOrWithoutPattern() throws E
401403
// 1970-01-01T08:00:02+08:00
402404
extractorAttributes.put("extractor.history.start-time", "2");
403405
extractorAttributes.put("extractor.history.end-time", "3");
406+
extractorAttributes.put("user", "root");
404407

405408
connectorAttributes.put("connector", "iotdb-thrift-connector");
406409
connectorAttributes.put("connector.batch.enable", "false");
@@ -498,6 +501,7 @@ public void testExtractorTimeRangeMatch() throws Exception {
498501
extractorAttributes.put("source.inclusion", "data.insert");
499502
extractorAttributes.put("source.start-time", "2");
500503
extractorAttributes.put("source.end-time", "4");
504+
extractorAttributes.put("user", "root");
501505

502506
final TSStatus status =
503507
client.createPipe(
@@ -616,6 +620,7 @@ public void testSourceStartTimeAndEndTimeWorkingWithOrWithoutPattern() throws Ex
616620
extractorAttributes.put("source.start-time", "2");
617621
// 1970-01-01T08:00:04+08:00
618622
extractorAttributes.put("source.end-time", "4");
623+
extractorAttributes.put("user", "root");
619624

620625
connectorAttributes.put("connector", "iotdb-thrift-connector");
621626
connectorAttributes.put("connector.batch.enable", "false");
@@ -733,6 +738,7 @@ public void testHistoryLooseRange() throws Exception {
733738
extractorAttributes.put("source.history.start-time", "1");
734739
extractorAttributes.put("source.history.end-time", "2");
735740
extractorAttributes.put("source.history.loose-range", "time, path");
741+
extractorAttributes.put("user", "root");
736742

737743
connectorAttributes.put("connector", "iotdb-thrift-connector");
738744
connectorAttributes.put("connector.batch.enable", "false");
@@ -789,6 +795,7 @@ public void testRealtimeLooseRange() throws Exception {
789795
extractorAttributes.put("source.start-time", "2");
790796
extractorAttributes.put("source.end-time", "10");
791797
extractorAttributes.put("source.realtime.mode", "batch");
798+
extractorAttributes.put("user", "root");
792799

793800
connectorAttributes.put("connector", "iotdb-thrift-connector");
794801
connectorAttributes.put("connector.batch.enable", "false");

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeLifeCycleIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public void testLifeCycleWithHistoryEnabled() throws Exception {
8484
final Map<String, String> connectorAttributes = new HashMap<>();
8585

8686
extractorAttributes.put("capture.table", "true");
87+
extractorAttributes.put("user", "root");
8788

8889
connectorAttributes.put("connector", "iotdb-thrift-connector");
8990
connectorAttributes.put("connector.batch.enable", "false");
@@ -161,6 +162,7 @@ public void testLifeCycleWithHistoryDisabled() throws Exception {
161162
final Map<String, String> connectorAttributes = new HashMap<>();
162163

163164
extractorAttributes.put("capture.table", "true");
165+
extractorAttributes.put("user", "root");
164166
extractorAttributes.put("extractor.inclusion", "data.insert");
165167
extractorAttributes.put("extractor.inclusion.exclusion", "");
166168

@@ -224,6 +226,7 @@ public void testLifeCycleLogMode() throws Exception {
224226

225227
extractorAttributes.put("capture.table", "true");
226228
extractorAttributes.put("extractor.mode", "forced-log");
229+
extractorAttributes.put("user", "root");
227230

228231
connectorAttributes.put("connector", "iotdb-thrift-connector");
229232
connectorAttributes.put("connector.batch.enable", "false");
@@ -286,6 +289,7 @@ public void testLifeCycleFileMode() throws Exception {
286289

287290
extractorAttributes.put("capture.table", "true");
288291
extractorAttributes.put("mode.streaming", "false");
292+
extractorAttributes.put("user", "root");
289293

290294
connectorAttributes.put("connector", "iotdb-thrift-connector");
291295
connectorAttributes.put("connector.batch.enable", "false");
@@ -347,6 +351,7 @@ public void testLifeCycleHybridMode() throws Exception {
347351

348352
extractorAttributes.put("capture.table", "true");
349353
extractorAttributes.put("extractor.mode", "hybrid");
354+
extractorAttributes.put("user", "root");
350355

351356
connectorAttributes.put("connector", "iotdb-thrift-connector");
352357
connectorAttributes.put("connector.batch.enable", "false");
@@ -404,6 +409,7 @@ public void testLifeCycleWithClusterRestart() throws Exception {
404409
final Map<String, String> connectorAttributes = new HashMap<>();
405410

406411
extractorAttributes.put("capture.table", "true");
412+
extractorAttributes.put("user", "root");
407413

408414
connectorAttributes.put("connector", "iotdb-thrift-connector");
409415
connectorAttributes.put("connector.batch.enable", "false");
@@ -474,6 +480,7 @@ public void testReceiverRestartWhenTransferring() throws Exception {
474480
final Map<String, String> connectorAttributes = new HashMap<>();
475481

476482
extractorAttributes.put("capture.table", "true");
483+
extractorAttributes.put("user", "root");
477484

478485
connectorAttributes.put("connector", "iotdb-thrift-connector");
479486
connectorAttributes.put("connector.batch.enable", "false");
@@ -557,6 +564,7 @@ public void testReceiverAlreadyHaveTimeSeries() throws Exception {
557564
final Map<String, String> connectorAttributes = new HashMap<>();
558565

559566
extractorAttributes.put("capture.table", "true");
567+
extractorAttributes.put("user", "root");
560568

561569
connectorAttributes.put("connector", "iotdb-thrift-connector");
562570
connectorAttributes.put("connector.batch.enable", "false");
@@ -625,6 +633,7 @@ public void testDoubleLiving() throws Exception {
625633
// Add this property to avoid to make self cycle.
626634
extractorAttributes.put("capture.table", "true");
627635
extractorAttributes.put("forwarding-pipe-requests", "false");
636+
extractorAttributes.put("user", "root");
628637

629638
connectorAttributes.put("connector", "iotdb-thrift-connector");
630639
connectorAttributes.put("connector.batch.enable", "false");
@@ -665,6 +674,7 @@ public void testDoubleLiving() throws Exception {
665674
extractorAttributes.put("capture.table", "true");
666675
extractorAttributes.put("capture.tree", "true");
667676
extractorAttributes.put("forwarding-pipe-requests", "false");
677+
extractorAttributes.put("user", "root");
668678

669679
connectorAttributes.put("connector", "iotdb-thrift-connector");
670680
connectorAttributes.put("connector.batch.enable", "false");

0 commit comments

Comments
 (0)