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
4 changes: 2 additions & 2 deletions plugin/trino-atop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
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.Duration;
import io.trino.plugin.atop.AtopConnectorConfig.AtopSecurity;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Resources;
import io.trino.testing.QueryRunner;
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 org.junit.jupiter.api.Timeout;

import java.io.File;
import java.io.IOException;
Expand All @@ -30,12 +32,14 @@
import static io.trino.plugin.atop.LocalAtopQueryRunner.createQueryRunner;
import static io.trino.testing.assertions.TrinoExceptionAssert.assertTrinoExceptionThrownBy;
import static java.nio.file.Files.createTempDirectory;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;

@TestInstance(PER_CLASS)
public class TestAtopHang
{
private QueryRunner queryRunner;

@BeforeClass
@BeforeAll
public void setUp()
throws Exception
{
Expand All @@ -44,14 +48,15 @@ public void setUp()
queryRunner = createQueryRunner(ImmutableMap.of("atop.executable-path", tempPath + "/hanging_atop.sh", "atop.executable-read-timeout", "1s"), AtopProcessFactory.class);
}

@AfterClass(alwaysRun = true)
@AfterAll
public void tearDown()
{
queryRunner.close();
queryRunner = null;
}

@Test(timeOut = 60_000)
@Test
@Timeout(60)
public void testTimeout()
{
assertTrinoExceptionThrownBy(() -> queryRunner.execute("SELECT * FROM disks"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.trino.spi.Plugin;
import io.trino.spi.connector.ConnectorFactory;
import io.trino.testing.TestingConnectorContext;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.nio.file.Files;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
import io.trino.spi.security.AccessDeniedException;
import io.trino.spi.security.Identity;
import io.trino.testing.QueryRunner;
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.io.File;
import java.nio.file.Files;
Expand All @@ -30,12 +31,14 @@
import static io.trino.plugin.atop.LocalAtopQueryRunner.createQueryRunner;
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)
public class TestAtopSecurity
{
private QueryRunner queryRunner;

@BeforeClass
@BeforeAll
public void setUp()
throws Exception
{
Expand All @@ -44,7 +47,7 @@ public void setUp()
queryRunner = createQueryRunner(ImmutableMap.of("atop.security", "file", "security.config-file", path, "atop.executable-path", atopExecutable.toString()), TestingAtopFactory.class);
}

@AfterClass(alwaysRun = true)
@AfterAll
public void tearDown()
{
queryRunner.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,27 @@
import io.trino.testing.MaterializedRow;
import io.trino.testing.QueryRunner;
import org.intellij.lang.annotations.Language;
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 static io.trino.plugin.atop.LocalAtopQueryRunner.createQueryRunner;
import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;

@TestInstance(PER_CLASS)
public class TestAtopSmoke
{
private QueryRunner queryRunner;

@BeforeClass
@BeforeAll
public void setUp()
{
queryRunner = createQueryRunner();
}

@AfterClass(alwaysRun = true)
@AfterAll
public void tearDown()
{
queryRunner.close();
Expand Down Expand Up @@ -65,8 +68,9 @@ private void assertThatQueryReturnsValue(@Language("SQL") String sql, Object exp
{
MaterializedResult rows = queryRunner.execute(sql);
MaterializedRow materializedRow = Iterables.getOnlyElement(rows);
assertEquals(materializedRow.getFieldCount(), 1, "column count");
Object value = materializedRow.getField(0);
assertEquals(value, expected);
assertThat(materializedRow.getFieldCount())
.as("column count")
.isEqualTo(1);
assertThat(materializedRow.getField(0)).isEqualTo(expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

import io.airlift.json.JsonCodec;
import io.trino.spi.HostAddress;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.time.ZoneId;
import java.time.ZonedDateTime;

import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

public class TestAtopSplit
{
Expand All @@ -31,9 +31,9 @@ public void testSerialization()
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("+01:23"));
AtopSplit split = new AtopSplit(HostAddress.fromParts("localhost", 123), now.toEpochSecond(), now.getZone().getId());
AtopSplit decoded = codec.fromJson(codec.toJson(split));
assertEquals(decoded.getHost(), split.getHost());
assertEquals(decoded.getDate(), split.getDate());
assertEquals(decoded.getEpochSeconds(), split.getEpochSeconds());
assertEquals(decoded.getTimeZoneId(), split.getTimeZoneId());
assertThat(decoded.getHost()).isEqualTo(split.getHost());
assertThat(decoded.getDate()).isEqualTo(split.getDate());
assertThat(decoded.getEpochSeconds()).isEqualTo(split.getEpochSeconds());
assertThat(decoded.getTimeZoneId()).isEqualTo(split.getTimeZoneId());
}
}