use of org.apache.ignite.spi.failover.GridFailoverTestContext in project ignite by apache.
the class GridJobStealingFailoverSpiSelfTest method testThiefEqualsVictim.
/**
* @throws Exception If test failed.
*/
public void testThiefEqualsVictim() throws Exception {
ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
GridTestJobResult failed = new GridTestJobResult(rmt);
failed.getJobContext().setAttribute(THIEF_NODE_ATTR, rmt.id());
ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), new ArrayList<>(getSpiContext().nodes()));
assert other != null;
assert other != rmt;
assert other.equals(getSpiContext().localNode());
checkAttributes(failed.getJobContext(), rmt, 1);
}
use of org.apache.ignite.spi.failover.GridFailoverTestContext in project ignite by apache.
the class GridAlwaysFailoverSpiSelfTest method testSingleNode.
/**
* @throws Exception If failed.
*/
public void testSingleNode() throws Exception {
AlwaysFailoverSpi spi = getSpi();
List<ClusterNode> nodes = new ArrayList<>();
ClusterNode node = new GridTestNode(UUID.randomUUID());
nodes.add(node);
node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes);
assert node == null;
}
use of org.apache.ignite.spi.failover.GridFailoverTestContext in project ignite by apache.
the class GridJobStealingFailoverSpiOneNodeSelfTest method testNoFailover.
/**
* @throws Exception If test failed.
*/
public void testNoFailover() throws Exception {
ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
GridTestJobResult failed = new GridTestJobResult(rmt);
ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), Collections.singletonList(getSpiContext().remoteNodes().iterator().next()));
assert other == null;
}
use of org.apache.ignite.spi.failover.GridFailoverTestContext in project ignite by apache.
the class GridJobStealingFailoverSpiSelfTest method testThiefNotInTopology.
/**
* @throws Exception If test failed.
*/
public void testThiefNotInTopology() throws Exception {
ClusterNode rmt = new GridTestNode(UUID.randomUUID());
GridTestJobResult failed = new GridTestJobResult(rmt);
failed.getJobContext().setAttribute(THIEF_NODE_ATTR, rmt.id());
ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), new ArrayList<>(getSpiContext().nodes()));
assert other != null;
assert other != rmt;
assert getSpiContext().nodes().contains(other);
checkAttributes(failed.getJobContext(), rmt, 1);
}
use of org.apache.ignite.spi.failover.GridFailoverTestContext in project ignite by apache.
the class GridJobStealingFailoverSpiSelfTest method testMaxHopsExceeded.
/**
* @throws Exception If test failed.
*/
public void testMaxHopsExceeded() throws Exception {
ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
GridTestJobResult failed = new GridTestJobResult(rmt);
failed.getJobContext().setAttribute(THIEF_NODE_ATTR, getSpiContext().localNode().id());
failed.getJobContext().setAttribute(FAILOVER_ATTEMPT_COUNT_ATTR, getSpi().getMaximumFailoverAttempts());
ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), new ArrayList<>(getSpiContext().nodes()));
assert other == null;
}
Aggregations