Skip to content

Commit

Permalink
Fixed TASKS_VIEW and JOBS_VIEW tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vladnovoren committed Dec 25, 2024
1 parent 2427079 commit 602e674
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import org.apache.ignite.internal.client.util.GridConcurrentHashSet;
import org.apache.ignite.internal.management.cache.FindAndDeleteGarbageInPersistenceTaskResult;
import org.apache.ignite.internal.management.cache.IdleVerifyDumpTask;
import org.apache.ignite.internal.management.cache.IdleVerifyTaskV2;
import org.apache.ignite.internal.management.cache.VerifyBackupPartitionsTaskV2;
import org.apache.ignite.internal.management.tx.TxInfo;
import org.apache.ignite.internal.management.tx.TxTaskResult;
Expand Down Expand Up @@ -135,6 +136,8 @@
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.metric.LongMetric;
import org.apache.ignite.spi.metric.Metric;
import org.apache.ignite.spi.systemview.view.ComputeJobView;
import org.apache.ignite.spi.systemview.view.ComputeTaskView;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
Expand Down Expand Up @@ -174,6 +177,8 @@
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess.SNAPSHOT_RESTORE_METRICS;
import static org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.GRID_NOT_IDLE_MSG;
import static org.apache.ignite.internal.processors.diagnostic.DiagnosticProcessor.DEFAULT_TARGET_FOLDER;
import static org.apache.ignite.internal.processors.job.GridJobProcessor.JOBS_VIEW;
import static org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
import static org.apache.ignite.testframework.GridTestUtils.assertContains;
import static org.apache.ignite.testframework.GridTestUtils.assertNotContains;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
Expand Down Expand Up @@ -781,10 +786,34 @@ public void testIdleVerifyCancelCommand() throws Exception {

IgniteInternalFuture<Integer> idleVerifyFut = GridTestUtils.runAsync(() -> execute("--cache", "idle_verify"));

doSleep(1000);

assertFalse(idleVerifyFut.isDone());

assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--cancel"));

for (int i = 0; i < gridsCnt; i++) {
int finalI = i;

waitForCondition(() -> {
for (ComputeTaskView taskView : grid(finalI).context().systemView().<ComputeTaskView>view(TASKS_VIEW)) {
if (IdleVerifyTaskV2.class.getName().equals(taskView.taskName()))
return false;
}

return true;
}, 1000);

waitForCondition(() -> {
for (ComputeJobView jobView : grid(finalI).context().systemView().<ComputeJobView>view(JOBS_VIEW)) {
if (IdleVerifyTaskV2.class.getName().equals(jobView.taskName()))
return false;
}

return true;
}, 1000);
}

idleVerifyFut.get(getTestTimeout());

assertTrue(idleVerifyCancelListener.check());
Expand Down

0 comments on commit 602e674

Please sign in to comment.