arjun4084346 commented on a change in pull request #2907: [GOBBLIN-1068]Clean 
up cyclic logic in task cancellation
URL: https://github.com/apache/incubator-gobblin/pull/2907#discussion_r404665523
 
 

 ##########
 File path: 
gobblin-cluster/src/test/java/org/apache/gobblin/cluster/suite/IntegrationJobCancelSuite.java
 ##########
 @@ -20,20 +20,26 @@
 import org.junit.Assert;
 
 import com.typesafe.config.Config;
+import com.typesafe.config.ConfigValueFactory;
+
+import static org.apache.gobblin.cluster.SleepingTask.SLEEPING_TASK_SLEEP_TIME;
 
 
 public class IntegrationJobCancelSuite extends IntegrationBasicSuite {
   public static final String JOB_ID = "job_HelloWorldTestJob_1234";
   public static final String TASK_STATE_FILE = 
"/tmp/IntegrationJobCancelSuite/taskState/_RUNNING";
 
   public IntegrationJobCancelSuite(Config jobConfigOverrides) {
-    super(jobConfigOverrides);
+    // Put SleepingTask in long sleep allowing cancellation to happen.
+    super(jobConfigOverrides.withValue(SLEEPING_TASK_SLEEP_TIME, 
ConfigValueFactory.fromAnyRef(100)));
   }
 
   @Override
   public void waitForAndVerifyOutputFiles() throws Exception {
+    // SleepingTask is in an infinite sleep. The log line is printed only when 
a cancellation in invoked.
+    Assert.assertTrue(verifyFileForMessage(this.jobLogOutputFile, "Sleep 
interrupted"));
+
     // If the job is cancelled, it should not have been able to write 'Hello 
World!'
     Assert.assertFalse(verifyFileForMessage(this.jobLogOutputFile, "Hello 
World!"));
 
 Review comment:
   Can we keep the deleted line. A bug was fixed and that line ensure that NPE 
does not happen. Yea, it can probably be replaced by 
Assert.assertFalse(verifyFileForMessage(this.jobLogOutputFile, "Exception"));

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to