NSAmelchev commented on code in PR #11689:
URL: https://github.com/apache/ignite/pull/11689#discussion_r1876457200


##########
modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/SecurityCommandHandlerPermissionsTest.java:
##########
@@ -133,6 +136,31 @@ public void testCacheCreate() throws Exception {
         );
     }
 
+    /** */
+    @Test
+    public void testServiceCancel() throws Exception {
+        String srvcName = "testService";
+        Collection<String> cmdArgs = asList("--kill", "service", srvcName);
+
+        Ignite ignite = startGrid(
+            0,
+            userData(TEST_NO_PERMISSIONS_LOGIN, NO_PERMISSIONS),
+            userData(TEST_LOGIN, servicePermission(srvcName, SERVICE_CANCEL))
+        );
+
+        ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+        srvcCfg.setName(srvcName);
+        srvcCfg.setMaxPerNodeCount(1);
+        srvcCfg.setTotalCount(1);
+        srvcCfg.setService(new ServicesTest.TestService());
+
+        ignite.services().deploy(srvcCfg);
+
+        assertEquals(EXIT_CODE_UNEXPECTED_ERROR, 
execute(enrichWithConnectionArguments(cmdArgs, TEST_NO_PERMISSIONS_LOGIN)));

Review Comment:
   Let's add a check to ensure that the service has not been cancelled.



##########
modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/SecurityCommandHandlerPermissionsTest.java:
##########
@@ -133,6 +136,31 @@ public void testCacheCreate() throws Exception {
         );
     }
 
+    /** */
+    @Test
+    public void testServiceCancel() throws Exception {
+        String srvcName = "testService";
+        Collection<String> cmdArgs = asList("--kill", "service", srvcName);
+
+        Ignite ignite = startGrid(
+            0,
+            userData(TEST_NO_PERMISSIONS_LOGIN, NO_PERMISSIONS),
+            userData(TEST_LOGIN, servicePermission(srvcName, SERVICE_CANCEL))
+        );
+
+        ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+        srvcCfg.setName(srvcName);
+        srvcCfg.setMaxPerNodeCount(1);
+        srvcCfg.setTotalCount(1);
+        srvcCfg.setService(new ServicesTest.TestService());
+
+        ignite.services().deploy(srvcCfg);
+
+        assertEquals(EXIT_CODE_UNEXPECTED_ERROR, 
execute(enrichWithConnectionArguments(cmdArgs, TEST_NO_PERMISSIONS_LOGIN)));
+        assertEquals(EXIT_CODE_OK, 
execute(enrichWithConnectionArguments(cmdArgs, TEST_LOGIN)));

Review Comment:
   Let's add a check to ensure that the service has been cancelled.



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

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

Reply via email to