[ 
https://issues.apache.org/jira/browse/IGNITE-23226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nikita Amelchev updated IGNITE-23226:
-------------------------------------
    Release Note: Fixed service descriptor when deployment failed

> Services: deployment failed but service descriptor stay
> -------------------------------------------------------
>
>                 Key: IGNITE-23226
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23226
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Nikolay Izhikov
>            Assignee: Vladislav Novikov
>            Priority: Minor
>              Labels: ise
>             Fix For: 2.17
>
>          Time Spent: 6h
>  Remaining Estimate: 0h
>
> In case service failed to deploy 
> {{Ignite.services().serviceDescriptors().isEmpty() == false}}.
> {code:java}
> public class IgniteServiceDeployUnknownClassTest extends 
> GridCommonAbstractTest {
>     /** */
>     private static final String NOOP_SERVICE_CLS_NAME = 
> "org.apache.ignite.tests.p2p.NoopService";
>     /** */
>     public static final String NODE_FILTER_CLS_NAME = 
> "org.apache.ignite.tests.p2p.ExcludeNodeFilter";
>     /** */
>     private static ClassLoader extClsLdr;
>     /** {@inheritDoc} */
>     @Override protected IgniteConfiguration getConfiguration(String 
> igniteInstanceName) throws Exception {
>         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
>         cfg.setPeerClassLoadingEnabled(false);
>         cfg.setFailureHandler(new StopNodeFailureHandler());
>         return cfg;
>     }
>     /** {@inheritDoc} */
>     @Override protected void beforeTest() throws Exception {
>         super.beforeTest();
>         extClsLdr = getExternalClassLoader();
>     }
>     /** {@inheritDoc} */
>     @Override protected void afterTest() throws Exception {
>         stopAllGrids();
>         super.afterTest();
>         extClsLdr = null;
>     }
>     /** @throws Exception If failed. */
>     @Test
>     public void testFailWhenClassNotFound() throws Exception {
>         IgniteEx srv = startGrid(getConfiguration("server"));
>         IgniteEx cli = startClientGrid(1);
>         ServiceConfiguration svcCfg = new ServiceConfiguration()
>             .setName("TestDeploymentService")
>             
> .setService(((Class<Service>)extClsLdr.loadClass(NOOP_SERVICE_CLS_NAME)).getDeclaredConstructor().newInstance())
>             
> .setNodeFilter(((Class<IgnitePredicate<ClusterNode>>)extClsLdr.loadClass(NODE_FILTER_CLS_NAME))
>                 .getConstructor(UUID.class)
>                 .newInstance(cli.configuration().getNodeId()))
>             .setTotalCount(1);
>         assertThrowsWithCause(() -> cli.services().deploy(svcCfg), 
> ServiceDeploymentException.class);
>         assertTrue(cli.services().serviceDescriptors().isEmpty());
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to