[ 
https://issues.apache.org/jira/browse/YARN-11695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17843400#comment-17843400
 ] 

ASF GitHub Bot commented on YARN-11695:
---------------------------------------

kaiyaok2 opened a new pull request, #6794:
URL: https://github.com/apache/hadoop/pull/6794

   ### Description of PR
   
   Following up #6793 
   
   All tests in `org.apache.hadoop.yarn.sls.scheduler.TestTaskRunner` are not 
idempotent and fails upon repeated execution within the same JVM instance due 
to self-induced state pollution. Specifically, the test runs made changes to 
the static fields (e.g. `PreStartTask.first` in the task classes without 
restoring them. Therefore, repeated runs throw assertion errors.
   
   Sample error message of `TestTaskRunner#testPreStartQueueing` in repeated 
test run:
   ```
   java.lang.AssertionError:
        at org.junit.Assert.fail(Assert.java:87)
        at org.junit.Assert.assertTrue(Assert.java:42)
        at org.junit.Assert.assertTrue(Assert.java:53)
        at 
org.apache.hadoop.yarn.sls.scheduler.TestTaskRunner.testPreStartQueueing(TestTaskRunner.java:244)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
   ``` 
   The fix is done by explicitly setting (resetting) the static variables 
(countdown latches and booleans) at the start of each test, so that each test 
runs on a fresh state.
   
   
   ### How was this patch tested?
   After the patch, rerunning the tests in the same JVM does not produce any 
exceptions.
   




> Fixed non-idempotent tests in `TestTaskRunner`
> ----------------------------------------------
>
>                 Key: YARN-11695
>                 URL: https://issues.apache.org/jira/browse/YARN-11695
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Kaiyao Ke
>            Priority: Major
>
> All tests in `org.apache.hadoop.yarn.sls.scheduler.TestTaskRunner` are not 
> idempotent and fails upon repeated execution within the same JVM instance due 
> to self-induced state pollution. Specifically, the test runs made changes to 
> the static fields (e.g. `PreStartTask.first` in the task classes without 
> restoring them. Therefore, repeated runs throw assertion errors.
> Sample error message of `TestTaskRunner#testPreStartQueueing` in repeated 
> test run:
> ```
> java.lang.AssertionError:
>       at org.junit.Assert.fail(Assert.java:87)
>       at org.junit.Assert.assertTrue(Assert.java:42)
>       at org.junit.Assert.assertTrue(Assert.java:53)
>       at 
> org.apache.hadoop.yarn.sls.scheduler.TestTaskRunner.testPreStartQueueing(TestTaskRunner.java:244)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> ``` 
> The fix is done by explicitly setting (resetting) the static variables 
> (countdown latches and booleans) at the start of each test.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to