@@ -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