Reject @BeforeMethod in Multi-threaded tests#15914
Conversation
|
Is part of this backported from Trino? Need to add the co-author tag and reference the original PR. |
Yes, I'll add |
5179e6e to
d4fe85c
Compare
aweisberg
left a comment
There was a problem hiding this comment.
Why did no tests violate the rule this time? Why does presto-elasticsearch not use this? Can you link to the original PR?
See my comment, I think this won't work as intended, but not sure. We registered our listeners in presto-main.
There was a problem hiding this comment.
We don't use this file here? https://github.com/prestodb/presto/blob/master/presto-main/src/test/resources/META-INF/services/org.testng.ITestNGListener
I don't think this actually works as intended, but not 100% sure. I suspect only the unit test actually incorporates this listener. The rest won't be using it.
If we are going to do presto-testing-services we should move everything over to it and make sure it's being leveraged by all the tests.
There was a problem hiding this comment.
There will be cyclic dependencies if put the listeners under presto-main so the listeners must reside in a separate project.
I debugged into the listeners and id really works. I will consolidate all the listeners into one place.
|
Backported from trinodb/trino#5412 and trinodb/trino#5420 |
That's because it checks not only single-threaded class, but also single-threaded test suite and we don't have any violations. |
7b46027 to
4b429da
Compare
9025286 to
85ec817
Compare
|
Force pushed to run FB integration test, wasn't getting a result before. |
|
Hmm after my rebasing it doesn't build anymore. |
a34b767 to
1cd67be
Compare
aweisberg
left a comment
There was a problem hiding this comment.
Waiting for a clean test run
b183519 to
660732b
Compare
|
Had a clean run, but this wasn't squashed so I squashed and rebased and am waiting for a clean run again. |
d17fc19 to
8884f41
Compare
Existence of @BeforeMethod or @AfterMethod most often indicates a shared mutable state that needs to be e.g. reset. This means the class should be marked @test(singleThreaded=true) Also allow @BeforeMethod and @AfterMethod on non-single-threaded test classes when the whole suite is marked as single-threaded. Co-authored-by: Piotr Findeisen <findepi@users.noreply.github.com>
8884f41 to
f5bb3b2
Compare
8884f41 to
f5bb3b2
Compare
This replaces #15756.
Existence of @BeforeMethod or @AfterMethod most often indicates a
shared mutable state that needs to be e.g. reset. This means the class
should be marked @test(singleThreaded=true)
Also allow @BeforeMethod and @AfterMethod on non-single-threaded test
classes when the whole suite is marked as single-threaded.
Depends on https://github.com/facebookexternal/presto-facebook/pull/1543