Skip to content

Commit

Permalink
Run trino-tests JUnit tests
Browse files Browse the repository at this point in the history
Fixes bunch of failing tests due to the tests being not executed for some time
  • Loading branch information
wendigo committed Dec 6, 2023
1 parent 9dd7f05 commit ae7849e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
16 changes: 11 additions & 5 deletions testing/trino-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand All @@ -327,11 +333,11 @@
<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-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import io.trino.Session;
import io.trino.execution.resourcegroups.InternalResourceGroupManager;
import io.trino.plugin.resourcegroups.ResourceGroupManagerPlugin;
import io.trino.server.PrefixObjectNameGeneratorModule;
import io.trino.spi.QueryId;
import io.trino.testing.DistributedQueryRunner;
import io.trino.tests.tpch.TpchQueryRunnerBuilder;
Expand Down Expand Up @@ -45,9 +44,7 @@ public class TestExecutionJmxMetrics
public void testQueryStats()
throws Exception
{
try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder()
.setAdditionalModule(new PrefixObjectNameGeneratorModule("io.trino"))
.build()) {
try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
InternalResourceGroupManager<?> resourceGroupManager = queryRunner.getCoordinator().getResourceGroupManager()
.orElseThrow(() -> new IllegalStateException("Resource manager not configured"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.parallel.Execution;

import java.time.Duration;
import java.util.Optional;
Expand All @@ -54,8 +55,10 @@
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;

@TestInstance(PER_CLASS)
@Execution(SAME_THREAD)
public class TestRefreshMaterializedView
extends AbstractTestQueryFramework
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME;
import static io.trino.testing.TestingSession.testSessionBuilder;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;

@TestInstance(PER_CLASS)
Expand Down Expand Up @@ -274,4 +275,13 @@ public void testLargeIn()
// testLargeIn is expensive
Assumptions.abort("Skipping testLargeIn");
}

@Test
@Override
public void testUnionAllAboveBroadcastJoin()
{
// TODO: https://github.com/trinodb/trino/issues/20043
assertThatThrownBy(super::testUnionAllAboveBroadcastJoin)
.hasMessageContaining("bytes is negative");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void testMaxSpillPerNodeLimit()
}
})
.isInstanceOf(RuntimeException.class)
.hasMessage(".*Query exceeded local spill limit of 10B");
.hasMessage("Query exceeded local spill limit of 10B");
}

@Test
Expand All @@ -86,7 +86,7 @@ public void testQueryMaxSpillPerNodeLimit()
}
})
.isInstanceOf(RuntimeException.class)
.hasMessageMatching(".*Query exceeded per-query local spill limit of 10B");
.hasMessageMatching("Query exceeded per-query local spill limit of 10B");
}

private LocalQueryRunner createLocalQueryRunner(NodeSpillConfig nodeSpillConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.parallel.Execution;

import java.net.URI;
import java.util.Collections;
Expand Down Expand Up @@ -82,7 +84,11 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Fail.fail;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT;

@TestInstance(PER_CLASS)
@Execution(CONCURRENT)
public class TestServer
{
private static final JsonCodec<QueryResults> QUERY_RESULTS_CODEC = jsonCodec(QueryResults.class);
Expand Down

0 comments on commit ae7849e

Please sign in to comment.