Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions client/trino-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@
import org.apache.hadoop.fs.FilterFileSystem;
import org.apache.hadoop.fs.Path;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.parallel.Execution;

import javax.management.MBeanServer;
import javax.management.ObjectName;
Expand Down Expand Up @@ -91,9 +93,12 @@
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD;
import static org.testng.Assert.assertEquals;

@Test(singleThreaded = true)
@TestInstance(PER_CLASS)
@Execution(SAME_THREAD)
public class TestRubixCaching
{
private static final DataSize SMALL_FILE_SIZE = DataSize.of(1, MEGABYTE);
Expand All @@ -109,7 +114,7 @@ public class TestRubixCaching
private FileSystem nonCachingFileSystem;
private FileSystem cachingFileSystem;

@BeforeClass
@BeforeAll
public void setup()
throws IOException
{
Expand All @@ -121,8 +126,8 @@ public void setup()
nonCachingFileSystem = getNonCachingFileSystem();
}

@AfterMethod(alwaysRun = true)
@BeforeMethod
@AfterEach
@BeforeEach
public void deinitializeRubix()
{
// revert static rubix initialization done by other tests
Expand Down Expand Up @@ -223,7 +228,7 @@ private FileSystem getCachingFileSystem(HdfsContext context, Path path)
return environment.getFileSystem(context, path);
}

@AfterClass(alwaysRun = true)
@AfterAll
public void tearDown()
throws IOException
{
Expand All @@ -232,7 +237,7 @@ public void tearDown()
mBeanServer = null;
}

@AfterMethod(alwaysRun = true)
@AfterEach
public void closeRubix()
throws IOException
{
Expand Down
22 changes: 0 additions & 22 deletions lib/trino-matching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,4 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
28 changes: 0 additions & 28 deletions lib/trino-memory-context/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,5 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static io.trino.memory.context.AggregatedMemoryContext.newRootAggregatedMemoryContext;
import static io.trino.memory.context.AggregatedMemoryContext.newSimpleAggregatedMemoryContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertTrue;

public class TestMemoryContexts
{
Expand All @@ -41,14 +38,14 @@ public void testLocalMemoryContextClose()
LocalMemoryContext localContext = aggregateContext.newLocalMemoryContext("test");
localContext.setBytes(100);

assertEquals(localContext.getBytes(), 100);
assertEquals(aggregateContext.getBytes(), 100);
assertEquals(reservationHandler.getReservation(), 100);
assertThat(localContext.getBytes()).isEqualTo(100);
assertThat(aggregateContext.getBytes()).isEqualTo(100);
assertThat(reservationHandler.getReservation()).isEqualTo(100);

localContext.close();
assertEquals(localContext.getBytes(), 0);
assertEquals(aggregateContext.getBytes(), 0);
assertEquals(reservationHandler.getReservation(), 0);
assertThat(localContext.getBytes()).isEqualTo(0);
assertThat(aggregateContext.getBytes()).isEqualTo(0);
assertThat(reservationHandler.getReservation()).isEqualTo(0);
}

@Test
Expand All @@ -58,22 +55,22 @@ public void testMemoryContexts()
AggregatedMemoryContext aggregateContext = newRootAggregatedMemoryContext(reservationHandler, GUARANTEED_MEMORY);
LocalMemoryContext localContext = aggregateContext.newLocalMemoryContext("test");

assertEquals(localContext.setBytes(10), NOT_BLOCKED);
assertEquals(localContext.getBytes(), 10);
assertEquals(aggregateContext.getBytes(), 10);
assertEquals(reservationHandler.getReservation(), aggregateContext.getBytes());
assertThat(localContext.setBytes(10)).isEqualTo(NOT_BLOCKED);
assertThat(localContext.getBytes()).isEqualTo(10);
assertThat(aggregateContext.getBytes()).isEqualTo(10);
assertThat(reservationHandler.getReservation()).isEqualTo(aggregateContext.getBytes());

LocalMemoryContext secondLocalContext = aggregateContext.newLocalMemoryContext("test");
assertEquals(secondLocalContext.setBytes(20), NOT_BLOCKED);
assertEquals(secondLocalContext.getBytes(), 20);
assertEquals(aggregateContext.getBytes(), 30);
assertEquals(localContext.getBytes(), 10);
assertEquals(reservationHandler.getReservation(), aggregateContext.getBytes());
assertThat(secondLocalContext.setBytes(20)).isEqualTo(NOT_BLOCKED);
assertThat(secondLocalContext.getBytes()).isEqualTo(20);
assertThat(aggregateContext.getBytes()).isEqualTo(30);
assertThat(localContext.getBytes()).isEqualTo(10);
assertThat(reservationHandler.getReservation()).isEqualTo(aggregateContext.getBytes());

aggregateContext.close();

assertEquals(aggregateContext.getBytes(), 0);
assertEquals(reservationHandler.getReservation(), 0);
assertThat(aggregateContext.getBytes()).isEqualTo(0);
assertThat(reservationHandler.getReservation()).isEqualTo(0);
}

@Test
Expand All @@ -85,19 +82,19 @@ public void testTryReserve()
AggregatedMemoryContext aggregateContext2 = parentContext.newAggregatedMemoryContext();
LocalMemoryContext childContext1 = aggregateContext1.newLocalMemoryContext("test");

assertTrue(childContext1.trySetBytes(500));
assertTrue(childContext1.trySetBytes(1_000));
assertFalse(childContext1.trySetBytes(1_001));
assertEquals(reservationHandler.getReservation(), parentContext.getBytes());
assertThat(childContext1.trySetBytes(500)).isTrue();
assertThat(childContext1.trySetBytes(1_000)).isTrue();
assertThat(childContext1.trySetBytes(1_001)).isFalse();
assertThat(reservationHandler.getReservation()).isEqualTo(parentContext.getBytes());

aggregateContext1.close();
aggregateContext2.close();
parentContext.close();

assertEquals(aggregateContext1.getBytes(), 0);
assertEquals(aggregateContext2.getBytes(), 0);
assertEquals(parentContext.getBytes(), 0);
assertEquals(reservationHandler.getReservation(), 0);
assertThat(aggregateContext1.getBytes()).isEqualTo(0);
assertThat(aggregateContext2.getBytes()).isEqualTo(0);
assertThat(parentContext.getBytes()).isEqualTo(0);
assertThat(reservationHandler.getReservation()).isEqualTo(0);
}

@Test
Expand All @@ -110,13 +107,13 @@ public void testHierarchicalMemoryContexts()
LocalMemoryContext childContext1 = aggregateContext1.newLocalMemoryContext("test");
LocalMemoryContext childContext2 = aggregateContext2.newLocalMemoryContext("test");

assertEquals(childContext1.setBytes(1), NOT_BLOCKED);
assertEquals(childContext2.setBytes(1), NOT_BLOCKED);
assertThat(childContext1.setBytes(1)).isEqualTo(NOT_BLOCKED);
assertThat(childContext2.setBytes(1)).isEqualTo(NOT_BLOCKED);

assertEquals(aggregateContext1.getBytes(), 1);
assertEquals(aggregateContext2.getBytes(), 1);
assertEquals(parentContext.getBytes(), aggregateContext1.getBytes() + aggregateContext2.getBytes());
assertEquals(reservationHandler.getReservation(), parentContext.getBytes());
assertThat(aggregateContext1.getBytes()).isEqualTo(1);
assertThat(aggregateContext2.getBytes()).isEqualTo(1);
assertThat(parentContext.getBytes()).isEqualTo(aggregateContext1.getBytes() + aggregateContext2.getBytes());
assertThat(reservationHandler.getReservation()).isEqualTo(parentContext.getBytes());
}

@Test
Expand All @@ -129,22 +126,23 @@ public void testGuaranteedMemoryDoesntBlock()

// exhaust the max memory available
reservationHandler.exhaustMemory();
assertEquals(reservationHandler.getReservation(), maxMemory);
assertThat(reservationHandler.getReservation()).isEqualTo(maxMemory);

// even if the pool is exhausted we never block queries using a trivial amount of memory
assertEquals(childContext.setBytes(1_000), NOT_BLOCKED);
assertNotEquals(childContext.setBytes(GUARANTEED_MEMORY + 1), NOT_BLOCKED);
assertThat(childContext.setBytes(1_000)).isEqualTo(NOT_BLOCKED);
assertThat(childContext.setBytes(GUARANTEED_MEMORY + 1))
.isNotEqualTo(NOT_BLOCKED);

// at this point the memory contexts have reserved GUARANTEED_MEMORY + 1 bytes
childContext.close();
parentContext.close();

assertEquals(childContext.getBytes(), 0);
assertEquals(parentContext.getBytes(), 0);
assertThat(childContext.getBytes()).isEqualTo(0);
assertThat(parentContext.getBytes()).isEqualTo(0);

// since we have exhausted the memory above after the memory contexts are closed
// the pool must still be exhausted
assertEquals(reservationHandler.getReservation(), maxMemory);
assertThat(reservationHandler.getReservation()).isEqualTo(maxMemory);
}

@Test
Expand Down
19 changes: 0 additions & 19 deletions lib/trino-plugin-toolkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,5 @@
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
18 changes: 0 additions & 18 deletions lib/trino-record-decoder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,6 @@
</ignoredResourcePatterns>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
18 changes: 0 additions & 18 deletions plugin/trino-accumulo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
Loading