You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2024/08/23 01:44:22 UTC

Re: [I] [Bug] hugeserver backend with postgresql schedule gremlin job unit test failed [incubator-hugegraph]

dosubot[bot] commented on issue #2648:
URL: https://github.com/apache/incubator-hugegraph/issues/2648#issuecomment-2306021253

   <!-- Answer -->
   To address the unit test failure in `testGremlinJobAndCancel` when using PostgreSQL as the backend in HugeServer, you can increase the sleep duration to allow more time for the task status to transition from `SCHEDULING` to `RUNNING`. This adjustment helps accommodate the longer time PostgreSQL may take for this transition.
   
   Here's the modified part of the `testGremlinJobAndCancel` method with an increased sleep duration:
   
   ```java
   @Test
   public void testGremlinJobAndCancel() throws TimeoutException {
       HugeGraph graph = graph();
       TaskScheduler scheduler = graph.taskScheduler();
   
       HugeTask<Object> task = runGremlinJob("Thread.sleep(1000 * 10);");
   
       // Increase sleep duration to 1000 ms
       sleepAWhile(1000);
       task = scheduler.task(task.id());
       scheduler.cancel(task);
   
       task = scheduler.task(task.id());
       Assert.assertEquals(TaskStatus.CANCELLING, task.status());
   
       task = scheduler.waitUntilTaskCompleted(task.id(), 10);
       Assert.assertEquals(TaskStatus.CANCELLED, task.status());
       Assert.assertEquals("test-gremlin-job", task.name());
       Assert.assertTrue(task.result(), task.result() == null ||
                                        task.result().endsWith("InterruptedException"));
   
       // Cancel success task
       HugeTask<Object> task2 = runGremlinJob("1+2");
       task2 = scheduler.waitUntilTaskCompleted(task2.id(), 10);
       Assert.assertEquals(TaskStatus.SUCCESS, task2.status());
       scheduler.cancel(task2);
       task2 = scheduler.task(task2.id());
       Assert.assertEquals(TaskStatus.SUCCESS, task2.status());
       Assert.assertEquals("3", task2.result());
   }
   ```
   
   This change should help mitigate the timing issue observed with PostgreSQL, allowing the test to pass successfully <sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/TaskCoreTest.java)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org