Skip to content

Commit 86c9cf9

Browse files
committed
refactor
1 parent 088bd1c commit 86c9cf9

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipePermissionIT.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ public void testSourcePermission() {
250250
+ "'node-urls'='%s')",
251251
receiverEnv.getDataNodeWrapperList().get(0).getIpAndPortString()));
252252
fail("When the 'user' or 'username' is specified, password must be specified too.");
253-
} catch (final SQLException ignore) {
254-
// Expected
253+
} catch (final SQLException e) {
254+
Assert.assertEquals(
255+
"701: Failed to create pipe a2b, in iotdb-source, password must be set when the username is specified.",
256+
e.getMessage());
255257
}
256258

257259
// Shall fail if password is wrong
@@ -262,13 +264,15 @@ public void testSourcePermission() {
262264
"create pipe a2b"
263265
+ " with source ("
264266
+ "'user'='thulab'"
265-
+ "'password'='hack')"
267+
+ ", 'password'='hack')"
266268
+ " with sink ("
267269
+ "'node-urls'='%s')",
268270
receiverEnv.getDataNodeWrapperList().get(0).getIpAndPortString()));
269271
fail("Shall fail if password is wrong.");
270-
} catch (final SQLException ignore) {
271-
// Expected
272+
} catch (final SQLException e) {
273+
Assert.assertEquals(
274+
"1107: ProcedureId 97: Fail to CREATE_PIPE because Authentication failed.",
275+
e.getMessage());
272276
}
273277

274278
// Use current session, user is root
@@ -290,10 +294,12 @@ public void testSourcePermission() {
290294
// Alter to another user, shall fail because of lack of password
291295
try (final Connection connection = senderEnv.getConnection();
292296
final Statement statement = connection.createStatement()) {
293-
statement.execute("alter pipe a2b modify source ('username'='thulab')");
297+
statement.execute("alter pipe a2b_realtime modify source ('username'='thulab')");
294298
fail("Alter pipe shall fail if only user is specified");
295-
} catch (final SQLException ignore) {
296-
// Expected
299+
} catch (final SQLException e) {
300+
Assert.assertEquals(
301+
"1107: Failed to alter pipe a2b_realtime, in iotdb-source, password must be set when the username is specified.",
302+
e.getMessage());
297303
}
298304

299305
// Successfully alter

0 commit comments

Comments
 (0)