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

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

kaiyaok2 commented on PR #6794:
URL: https://github.com/apache/hadoop/pull/6794#issuecomment-2094280302

   > @kaiyaok2 Thank you for your contribution! Enhancing unit tests is a good 
thing. #6793 and #6794 should ideally be fixed together as they both involve 
the YARN module. It's better not to make it too scattered.
   
   Thanks for pointing this out. I've merged changes in this PR to #6793.




> 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
>              Labels: pull-request-available
>
> 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