Fix for flaky failures of testNodeSingletonDeploy in Basic 2 - Fixes
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
import org.apache.ignite.services.ServiceContext;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.configvariations.Parameters;
import org.apache.ignite.testframework.junits.IgniteConfigVariationsAbstractTest;
@@ -46,6 +47,9 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
/** Test service name. */
private static final String SERVICE_NAME = "testService";
+ /** Timeout to wait finish of a service's deployment. */
+ private static final long DEPLOYMENT_WAIT_TIMEOUT = 10_000L;
+
/** Test service name. */
private static final String CACHE_NAME = "testCache";
@@ -82,8 +86,11 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
*/
public void testNodeSingletonDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(true, new DeployClosure() {
- @Override public void run(IgniteServices services, String svcName, TestService svc) {
+ @Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception {
services.deployNodeSingleton(svcName, (Service)svc);
+
+ // TODO: Waiting for deployment should be removed after IEP-17 completion
+ GridTestUtils.waitForCondition(() -> services.service(svcName) != null, DEPLOYMENT_WAIT_TIMEOUT);
}
}));
}
@@ -95,8 +102,11 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
*/
public void testClusterSingletonDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(false, new DeployClosure() {
- @Override public void run(IgniteServices services, String svcName, TestService svc) {
+ @Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception {
services.deployClusterSingleton(svcName, (Service)svc);
+
+ // TODO: Waiting for deployment should be removed after IEP-17 completion
+ GridTestUtils.waitForCondition(() -> services.service(svcName) != null, DEPLOYMENT_WAIT_TIMEOUT);
}
}));
}
@@ -141,7 +151,7 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
*/
public void testDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(false, new DeployClosure() {
- @Override public void run(IgniteServices services, String svcName, TestService svc) {
+ @Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception {
services.deployClusterSingleton(svcName, (Service)svc);
ServiceConfiguration cfg = new ServiceConfiguration();
@@ -157,6 +167,9 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
cfg.setNodeFilter(services.clusterGroup().predicate());
services.deploy(cfg);
+
+ // TODO: Waiting for deployment should be removed after IEP-17 completion
+ GridTestUtils.waitForCondition(() -> services.service(svcName) != null, DEPLOYMENT_WAIT_TIMEOUT);
}
}));
}
@@ -198,8 +211,9 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
* @param services Services.
* @param svcName Service name.
* @param svc Service.
+ * @throws Exception In case of an error.
*/
- void run(IgniteServices services, String svcName, TestService svc);
+ void run(IgniteServices services, String svcName, TestService svc) throws Exception;
}
/**
