You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ibessonov (via GitHub)" <gi...@apache.org> on 2023/05/05 10:09:26 UTC

[GitHub] [ignite-3] ibessonov commented on a diff in pull request #1991: IGNITE-19077 Apply custom cluster config on cluster init

ibessonov commented on code in PR #1991:
URL: https://github.com/apache/ignite-3/pull/1991#discussion_r1185900560


##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlConnectBasicTest.java:
##########
@@ -21,31 +21,22 @@
 import static org.apache.ignite.internal.cli.commands.cliconfig.TestConfigManagerHelper.createJdbcTestsBasicSecretConfig;
 import static org.junit.jupiter.api.Assertions.assertAll;
 
+import java.io.IOException;
 import org.apache.ignite.InitParametersBuilder;
+import org.apache.ignite.internal.cli.commands.cliconfig.TestConfigManagerHelper;
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
 
 class ItSqlConnectBasicTest extends CliSqlConnectCommandTestBase {
 
     @Override
     protected void configureInitParameters(InitParametersBuilder builder) {
-        builder.clusterConfiguration(
-                "{\n"
-                + "  \"security\": {\n"
-                + "    \"authentication\": {\n"
-                + "      \"enabled\": true,\n"
-                + "      \"providers\": [\n"
-                + "        {\n"
-                + "          \"name\": \"basic\",\n"
-                + "          \"type\": \"basic\",\n"
-                + "          \"username\": \"usr\",\n"
-                + "          \"password\": \"pwd\"\n"
-                + "        }\n"
-                + "      ]\n"
-                + "    }\n"
-                + "  }\n"
-                + "}\n"
-        );
+        try {
+            String clusterConfig = TestConfigManagerHelper.readResourceToString("cluster-configuration-with-enabled-auth.conf");
+            builder.clusterConfiguration(clusterConfig);
+        } catch (IOException e) {

Review Comment:
   Do we really need this catch in every tests that uses this method?
   `readResourceToString` may throw different exception, there's nothing bad in such approach



##########
modules/cli/src/testFixtures/resources/cluster-configuration-with-enabled-auth.conf:
##########
@@ -0,0 +1,15 @@
+{

Review Comment:
   I'm not sure these braces are required. File would be simpler with no extra padding I think



##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlConnectBasicTest.java:
##########
@@ -21,31 +21,22 @@
 import static org.apache.ignite.internal.cli.commands.cliconfig.TestConfigManagerHelper.createJdbcTestsBasicSecretConfig;
 import static org.junit.jupiter.api.Assertions.assertAll;
 
+import java.io.IOException;
 import org.apache.ignite.InitParametersBuilder;
+import org.apache.ignite.internal.cli.commands.cliconfig.TestConfigManagerHelper;
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
 
 class ItSqlConnectBasicTest extends CliSqlConnectCommandTestBase {
 
     @Override
     protected void configureInitParameters(InitParametersBuilder builder) {
-        builder.clusterConfiguration(
-                "{\n"
-                + "  \"security\": {\n"
-                + "    \"authentication\": {\n"
-                + "      \"enabled\": true,\n"
-                + "      \"providers\": [\n"
-                + "        {\n"
-                + "          \"name\": \"basic\",\n"
-                + "          \"type\": \"basic\",\n"
-                + "          \"username\": \"usr\",\n"
-                + "          \"password\": \"pwd\"\n"
-                + "        }\n"
-                + "      ]\n"
-                + "    }\n"
-                + "  }\n"
-                + "}\n"
-        );
+        try {
+            String clusterConfig = TestConfigManagerHelper.readResourceToString("cluster-configuration-with-enabled-auth.conf");

Review Comment:
   Magic constant, you should probably move it to `TestConfigManagerHelper`



-- 
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@ignite.apache.org

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