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/12/14 11:26:23 UTC

[GitHub] [shardingsphere] yx9o commented on a diff in pull request #22860: Fix DROP DEFAULT SHADOW ALGORITHM.

yx9o commented on code in PR #22860:
URL: https://github.com/apache/shardingsphere/pull/22860#discussion_r1048351973


##########
features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java:
##########
@@ -55,12 +59,15 @@ public void assertCheckWithIfExists() {
     
     @Test
     public void assertUpdate() {
+        String algorithmName = "default";
         ShadowRuleConfiguration ruleConfig = new ShadowRuleConfiguration();
-        ruleConfig.setDefaultShadowAlgorithmName("default");
+        ruleConfig.getShadowAlgorithms().put(algorithmName, mock(AlgorithmConfiguration.class));
+        ruleConfig.setDefaultShadowAlgorithmName(algorithmName);
         DropDefaultShadowAlgorithmStatement statement = new DropDefaultShadowAlgorithmStatement(false);
         updater.checkSQLStatement(database, new DropDefaultShadowAlgorithmStatement(true), ruleConfig);
         assertTrue(updater.hasAnyOneToBeDropped(statement, ruleConfig));
         updater.updateCurrentRuleConfiguration(statement, ruleConfig);
         assertNull(ruleConfig.getDefaultShadowAlgorithmName());
+        assertThat(ruleConfig.getShadowAlgorithms().size(), is(0));

Review Comment:
   > `assertTrue(ruleConfig.getShadowAlgorithms().isEmpty());` will be better?
   
   ok



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