Search in sources :

Example 11 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridJobStealingFailoverSpiSelfTest method testThiefIdNotSet.

/**
     * @throws Exception If test failed.
     */
public void testThiefIdNotSet() throws Exception {
    ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
    GridTestJobResult failed = new GridTestJobResult(rmt);
    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);
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 12 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridJobStealingFailoverSpiSelfTest method testNonZeroFailoverCount.

/**
     * @throws Exception If test failed.
     */
public void testNonZeroFailoverCount() throws Exception {
    ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
    GridTestJobResult failed = new GridTestJobResult(rmt);
    failed.getJobContext().setAttribute(FAILOVER_ATTEMPT_COUNT_ATTR, getSpi().getMaximumFailoverAttempts() - 1);
    ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), new ArrayList<>(getSpiContext().nodes()));
    assert other != null;
    assert other != rmt;
    assert other == getSpiContext().localNode();
    checkAttributes(failed.getJobContext(), rmt, getSpi().getMaximumFailoverAttempts());
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 13 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult 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;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Aggregations

GridTestJobResult (org.apache.ignite.GridTestJobResult)13 GridTestTaskSession (org.apache.ignite.GridTestTaskSession)13 ClusterNode (org.apache.ignite.cluster.ClusterNode)13 GridFailoverTestContext (org.apache.ignite.spi.failover.GridFailoverTestContext)13 GridTestNode (org.apache.ignite.testframework.GridTestNode)5 ArrayList (java.util.ArrayList)4 ComputeJobResult (org.apache.ignite.compute.ComputeJobResult)2