Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate exchange-filesystem to JUnit #18681

Merged
merged 1 commit into from
Aug 17, 2023
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
8 changes: 4 additions & 4 deletions plugin/trino-exchange-filesystem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,14 @@
</dependency>

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

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
import io.trino.spi.exchange.ExchangeSourceHandle;
import io.trino.spi.exchange.ExchangeSourceHandleSource.ExchangeSourceHandleBatch;
import io.trino.spi.exchange.ExchangeSourceOutputSelector;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
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 java.util.ArrayDeque;
import java.util.List;
Expand All @@ -54,20 +55,21 @@
import static java.lang.Math.toIntExact;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.Assert.assertTrue;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;

@TestInstance(PER_CLASS)
public abstract class AbstractTestExchangeManager
{
private ExchangeManager exchangeManager;

@BeforeClass
@BeforeAll
public void init()
throws Exception
{
exchangeManager = createExchangeManager();
}

@AfterClass(alwaysRun = true)
@AfterAll
public void destroy()
throws Exception
{
Expand Down Expand Up @@ -158,7 +160,7 @@ public void testHappyPath()
exchange.allRequiredSinksFinished();

ExchangeSourceHandleBatch sourceHandleBatch = exchange.getSourceHandles().getNextBatch().get();
assertTrue(sourceHandleBatch.lastBatch());
assertThat(sourceHandleBatch.lastBatch()).isTrue();
List<ExchangeSourceHandle> partitionHandles = sourceHandleBatch.handles();
assertThat(partitionHandles).hasSize(2);

Expand Down Expand Up @@ -232,7 +234,7 @@ public void testLargePages()
exchange.allRequiredSinksFinished();

ExchangeSourceHandleBatch sourceHandleBatch = exchange.getSourceHandles().getNextBatch().get();
assertTrue(sourceHandleBatch.lastBatch());
assertThat(sourceHandleBatch.lastBatch()).isTrue();
List<ExchangeSourceHandle> partitionHandles = sourceHandleBatch.handles();
assertThat(partitionHandles).hasSize(10);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import com.google.common.collect.ImmutableMap;
import io.airlift.units.DataSize;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package io.trino.plugin.exchange.filesystem;

import io.trino.plugin.exchange.filesystem.local.LocalFileSystemExchangeStorage;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.util.concurrent.CompletableFuture;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import com.google.common.collect.ImmutableMap;
import io.airlift.units.DataSize;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.google.common.collect.ImmutableMap;
import io.airlift.units.DataSize;
import io.airlift.units.Duration;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.services.s3.model.StorageClass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.trino.plugin.exchange.filesystem.FileSystemExchangeManagerFactory;
import io.trino.plugin.exchange.filesystem.containers.MinioStorage;
import io.trino.spi.exchange.ExchangeManager;
import org.testng.annotations.AfterClass;
import org.junit.jupiter.api.AfterAll;

import static io.trino.plugin.exchange.filesystem.containers.MinioStorage.getExchangeManagerProperties;
import static java.util.UUID.randomUUID;
Expand All @@ -37,7 +37,7 @@ protected ExchangeManager createExchangeManager()
}

@Override
@AfterClass(alwaysRun = true)
@AfterAll
public void destroy()
throws Exception
{
Expand Down