Skip to content

Commit

Permalink
Reject @BeforeMethod in Multi-threaded tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
2 people authored and highker committed May 25, 2021
1 parent f38548b commit 56c5e52
Show file tree
Hide file tree
Showing 75 changed files with 636 additions and 7 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<module>presto-common</module>
<module>presto-thrift-testing-udf-server</module>
<module>presto-thrift-spec</module>
<module>testing/presto-testng-services</module>
</modules>

<dependencyManagement>
Expand Down Expand Up @@ -654,6 +655,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.facebook.hive</groupId>
<artifactId>hive-dwrf</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-accumulo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-array/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-atop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-tests</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-base-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-benchmark-driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-benchto-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
<version>0.4</version>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-blackhole/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-tests</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-bytecode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-druid/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-example-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-function-namespace-managers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>testing</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-geospatial-toolkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-geospatial/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto.hadoop</groupId>
<artifactId>hadoop-apache2</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-hive-hadoop2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-hive-metastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-spi</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-i18n-functions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-jmx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-kudu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-local-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions presto-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@
<groupId>com.facebook.presto</groupId>
<artifactId>presto-plugin-toolkit</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Loading

0 comments on commit 56c5e52

Please sign in to comment.