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