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

Catalog manager test fix #10

Merged
merged 2 commits into from
Dec 24, 2024
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
2 changes: 1 addition & 1 deletion core/trino-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<dependency>
<groupId>io.arenadata</groupId>
<artifactId>trino-catalog-manager</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${arenadata-catalog-manager.version}</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.trino.sql.tree.CreateCatalog;
import io.trino.sql.tree.DropCatalog;
import io.trino.sql.tree.Identifier;
import io.trino.sql.tree.NodeLocation;
import io.trino.sql.tree.Property;
import io.trino.sql.tree.Statement;
import io.trino.sql.tree.StringLiteral;
Expand Down Expand Up @@ -117,9 +118,9 @@ public void tearDown()
@AfterEach
public void afterDown()
{
DropCatalog statement = new DropCatalog(new Identifier(TEST_CATALOG), true, false);
DropCatalog statement2 = new DropCatalog(new Identifier(TEST_CATALOG2), true, false);
DropCatalog statement3 = new DropCatalog(new Identifier(TEST_CATALOG3), true, false);
DropCatalog statement = new DropCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), true, false);
DropCatalog statement2 = new DropCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG2), true, false);
DropCatalog statement3 = new DropCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG3), true, false);
getFutureValue(dropTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
getFutureValue(dropTask.execute(statement2, createNewQuery(), emptyList(), WarningCollector.NOOP));
getFutureValue(dropTask.execute(statement3, createNewQuery(), emptyList(), WarningCollector.NOOP));
Expand All @@ -128,7 +129,7 @@ public void afterDown()
@Test
public void testDuplicatedCreateCatalog()
{
CreateCatalog statement = new CreateCatalog(new Identifier(TEST_CATALOG), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement = new CreateCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
getFutureValue(createTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isTrue();
assertThat(queryRunner.getPlannerContext().getMetadata().listCatalogs(createNewQuery().getSession()).stream()
Expand All @@ -142,7 +143,7 @@ public void testDuplicatedCreateCatalog()
@Test
public void testDuplicatedCreateCatalogIfNotExists()
{
CreateCatalog statement = new CreateCatalog(new Identifier(TEST_CATALOG), true, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement = new CreateCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), true, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
getFutureValue(createTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isTrue();
getFutureValue(createTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
Expand All @@ -157,7 +158,7 @@ public void testDropNotExistedCatalog()
{
queryRunner.createCatalog(TEST_CATALOG, "tpch", ImmutableMap.of());
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isTrue();
DropCatalog statement = new DropCatalog(new Identifier(TEST_CATALOG), false, false);
DropCatalog statement = new DropCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), false, false);
getFutureValue(dropTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isFalse();
assertThatExceptionOfType(TrinoException.class)
Expand All @@ -173,7 +174,7 @@ public void testDropCatalogIfNotExists()
{
queryRunner.createCatalog(TEST_CATALOG, "tpch", ImmutableMap.of());
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isTrue();
DropCatalog statement = new DropCatalog(new Identifier(TEST_CATALOG), true, false);
DropCatalog statement = new DropCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), true, false);
getFutureValue(dropTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
assertThat(queryRunner.getPlannerContext().getMetadata().catalogExists(createNewQuery().getSession(), TEST_CATALOG)).isFalse();
getFutureValue(dropTask.execute(statement, createNewQuery(), emptyList(), WarningCollector.NOOP));
Expand All @@ -186,9 +187,9 @@ public void testDropCatalogIfNotExists()
@Test
public void testCreateCatalogs()
{
CreateCatalog statement1 = new CreateCatalog(new Identifier(TEST_CATALOG), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement2 = new CreateCatalog(new Identifier(TEST_CATALOG2), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement3 = new CreateCatalog(new Identifier(TEST_CATALOG3), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement1 = new CreateCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement2 = new CreateCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG2), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
CreateCatalog statement3 = new CreateCatalog(new NodeLocation(1, 1), new Identifier(TEST_CATALOG3), false, new Identifier("tpch"), TPCH_PROPERTIES, Optional.empty(), Optional.empty());
getFutureValue(createTask.execute(statement1, createNewQuery(), emptyList(), WarningCollector.NOOP));
getFutureValue(createTask.execute(statement2, createNewQuery(), emptyList(), WarningCollector.NOOP));
getFutureValue(createTask.execute(statement3, createNewQuery(), emptyList(), WarningCollector.NOOP));
Expand All @@ -208,7 +209,7 @@ public void failCreateCatalog()
{
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> getFutureValue(createTask.execute(
new CreateCatalog(
new CreateCatalog(new NodeLocation(1, 1),
new Identifier(TEST_CATALOG),
true,
new Identifier("fail"),
Expand Down
25 changes: 25 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
Since 1.1.0, the default behaviour for such conflicts changed from overwriting the artifact to failing the build.
-->
<provisio.fallbackTargetFileNameMode>GA</provisio.fallbackTargetFileNameMode>
<arenadata-catalog-manager.version>1.0-SNAPSHOT</arenadata-catalog-manager.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -2752,6 +2753,30 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>io.arenadata</groupId>
<artifactId>trino-catalog-manager</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions testing/trino-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.arenadata</groupId>
<artifactId>trino-catalog-manager</artifactId>
<version>${arenadata-catalog-manager.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
Expand Down Expand Up @@ -205,6 +212,12 @@
<groupId>io.trino</groupId>
<artifactId>trino-main</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.arenadata</groupId>
<artifactId>trino-catalog-manager</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Loading