File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
integration-test/src/test/java/org/apache/iotdb/db/it/auth
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 4444import java .util .HashSet ;
4545import java .util .Set ;
4646
47+ import static org .junit .jupiter .api .Assertions .assertEquals ;
48+
4749@ RunWith (IoTDBTestRunner .class )
4850@ Category ({TableLocalStandaloneIT .class , TableClusterIT .class })
4951public class IoTDBRelationalAuthIT {
@@ -620,4 +622,16 @@ public void testCreateUserAndRole() throws SQLException {
620622 Assert .fail ();
621623 }
622624 }
625+
626+ @ Test
627+ public void testAlterNonExistingUser () throws SQLException {
628+ try (Connection adminCon = EnvFactory .getEnv ().getConnection (BaseEnv .TABLE_SQL_DIALECT );
629+ Statement adminStmt = adminCon .createStatement ()) {
630+ try {
631+ adminStmt .execute ("ALTER USER nonExist SET PASSWORD 'asdfer1124566'" );
632+ } catch (SQLException e ) {
633+ assertEquals ("701: User nonExist not found" , e .getMessage ());
634+ }
635+ }
636+ }
623637}
Original file line number Diff line number Diff line change @@ -540,10 +540,10 @@ public User getUser(String userName) {
540540 } catch (ClientManagerException | TException e ) {
541541 LOGGER .error (CONNECTERROR );
542542 }
543- user = cacheUser (permissionInfoResp );
544543 if (permissionInfoResp != null
545544 && permissionInfoResp .getStatus ().getCode ()
546545 == TSStatusCode .SUCCESS_STATUS .getStatusCode ()) {
546+ user = cacheUser (permissionInfoResp );
547547 if (acceptCache ) {
548548 iAuthorCache .putUserCache (userName , user );
549549 }
You can’t perform that action at this time.
0 commit comments