You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/14 04:49:59 UTC

[GitHub] [shardingsphere] sandynz commented on a diff in pull request #19124: Scaling IT use accounts with restricted privileges

sandynz commented on code in PR #19124:
URL: https://github.com/apache/shardingsphere/pull/19124#discussion_r920742281


##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java:
##########
@@ -104,6 +102,10 @@ public abstract class BaseITCase {
     @Setter
     private Thread increaseTaskThread;
     
+    private String username;
+    
+    private String password;

Review Comment:
   Could be final?



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql:
##########
@@ -0,0 +1,20 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- if the database already exists, need grant all privileges on database exist_database to scaling;
+CREATE USER scaling WITH ENCRYPTED PASSWORD 'root';
+CREATE DATABASE scaling;
+ALTER ROLE scaling CREATEDB REPLICATION;

Review Comment:
   Is CRUD privilege needed?



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java:
##########
@@ -369,9 +374,10 @@ protected void waitScalingFinished(final String jobId) throws InterruptedExcepti
             boolean finished = true;
             for (Map<String, Object> entry : showScalingStatusResMap) {
                 String status = entry.get("status").toString();
-                assertThat(status, not(JobStatus.PREPARING_FAILURE.name()));
-                assertThat(status, not(JobStatus.EXECUTE_INVENTORY_TASK_FAILURE.name()));
-                assertThat(status, not(JobStatus.EXECUTE_INCREMENTAL_TASK_FAILURE.name()));
+                // TODO stop scaling async maybe cause the exception, not assert 
+//                assertThat(status, not(JobStatus.PREPARING_FAILURE.name()));
+//                assertThat(status, not(JobStatus.EXECUTE_INVENTORY_TASK_FAILURE.name()));
+//                assertThat(status, not(JobStatus.EXECUTE_INCREMENTAL_TASK_FAILURE.name()));

Review Comment:
   Stop scaling job asynchronously could be improved, and recover  these code.



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql:
##########
@@ -0,0 +1,20 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+-- if the database already exists, need grant all privileges on database exist_database to scaling;
+CREATE USER scaling WITH ENCRYPTED PASSWORD 'root';
+CREATE DATABASE scaling;
+ALTER ROLE scaling CREATEDB REPLICATION;

Review Comment:
   Is `LOGIN` needed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org