Skip to content
Draft
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
28 changes: 20 additions & 8 deletions build-logic/src/main/kotlin/polaris-runtime.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,32 @@ testing {
tasks.named(sources.compileJavaTaskName).configure {
dependsOn("compileQuarkusTestGeneratedSourcesJava")
}
configurations.named(sources.runtimeOnlyConfigurationName).configure {
extendsFrom(configurations.getByName("testRuntimeOnly"))
}
configurations.named(sources.implementationConfigurationName).configure {
// Let the test's implementation config extend testImplementation, so it also inherits the
// project's "main" implementation dependencies (not just the "api" configuration)
extendsFrom(configurations.getByName("testImplementation"))
}
sources { java.srcDirs(tasks.named("quarkusGenerateCodeTests")) }
}

listOf("intTest", "cloudTest").forEach {
register<JvmTestSuite>(it).configure { intTestSuiteConfigure(this) }
}

named<JvmTestSuite>("intTest").configure {
configurations.named(sources.runtimeOnlyConfigurationName).configure {
extendsFrom(configurations.getByName("testRuntimeOnly"))
}
configurations.named(sources.implementationConfigurationName).configure {
// Let the test's implementation config extend testImplementation, so it also inherits the
// project's "main" implementation dependencies (not just the "api" configuration)
extendsFrom(configurations.getByName("testImplementation"))
}
}

named<JvmTestSuite>("cloudTest").configure {
configurations.named(sources.runtimeOnlyConfigurationName).configure {
extendsFrom(configurations.getByName("intTestRuntimeOnly"))
}
configurations.named(sources.implementationConfigurationName).configure {
extendsFrom(configurations.getByName("intTestImplementation"))
}
}
}
}

Expand Down
25 changes: 25 additions & 0 deletions runtime/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ following command:
-Dquarkus.container-image.group=apache \
-Dquarkus.container-image.name=polaris-local
```

## Integration tests

Integration tests from the `:polaris-tests` module can be run against a local Polaris Quarkus instance
for each supported cloud storage. Set the appropriate environment variables for your target cloud,
then run the tests as shown below.

For S3:
```shell
export INTEGRATION_TEST_S3_PATH="s3://bucket/subpath"
export INTEGRATION_TEST_S3_ROLE_ARN="your-role-arn"
./gradlew :polaris-server:cloudTest
```
For ADLS:
```shell
export INTEGRATION_TEST_AZURE_PATH="abfss://bucket/subpath"
export INTEGRATION_TEST_AZURE_TENANT_ID="your-tenant-id"
./gradlew :polaris-server:cloudTest
```
For GCS:
```shell
export INTEGRATION_TEST_GCS_PATH="gs://bucket/subpath"
export INTEGRATION_TEST_GCS_SERVICE_ACCOUNT="your-service-account"
./gradlew :polaris-server:cloudTest
```
94 changes: 94 additions & 0 deletions runtime/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,33 @@ dependencies {
// enforce the Quarkus _platform_ here, to get a consistent and validated set of dependencies
implementation(enforcedPlatform(libs.quarkus.bom))
implementation("io.quarkus:quarkus-container-image-docker")

testImplementation(enforcedPlatform(libs.quarkus.bom))
testImplementation("io.quarkus:quarkus-junit5")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions / doubts here:

  1. Why modify the testImplementation configuration here? I don't think it applies to integration tests.
  2. Do we need to add testImplementation(enforcedPlatform(libs.quarkus.bom))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, my mistake. Thx for catching it... will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make a build config change and move a non-QuarkusIntegrationTest back to runtime/service... but I hope the end result is better now :)


intTestImplementation(testFixtures(project(":polaris-runtime-service")))
intTestImplementation(project(":polaris-runtime-test-common"))
intTestImplementation(project(":polaris-core"))
intTestImplementation(project(":polaris-api-management-model"))
intTestImplementation(project(":polaris-minio-testcontainer"))

intTestImplementation(project(":polaris-tests")) {
// exclude all spark dependencies
exclude(group = "org.apache.iceberg", module = "iceberg-spark-3.5_2.12")
exclude(group = "org.apache.iceberg", module = "iceberg-spark-extensions-3.5_2.12")
exclude(group = "org.apache.spark", module = "spark-sql_2.12")
}

intTestImplementation(platform(libs.iceberg.bom))
intTestImplementation("org.apache.iceberg:iceberg-api")
intTestImplementation("org.apache.iceberg:iceberg-core")
intTestImplementation("org.apache.iceberg:iceberg-aws")
intTestImplementation("org.apache.iceberg:iceberg-api:${libs.versions.iceberg.get()}:tests")
intTestImplementation("org.apache.iceberg:iceberg-core:${libs.versions.iceberg.get()}:tests")

// This dependency brings in RESTEasy Classic, which conflicts with Quarkus RESTEasy Reactive;
// it must not be present during Quarkus augmentation otherwise Quarkus tests won't start.
intTestRuntimeOnly(libs.keycloak.admin.client)
}

quarkus {
Expand Down Expand Up @@ -100,3 +127,70 @@ artifacts {
}
add("distributionElements", layout.buildDirectory.dir("quarkus-app")) { builtBy("quarkusBuild") }
}

tasks.withType(Test::class.java).configureEach {
if (System.getenv("AWS_REGION") == null) {
environment("AWS_REGION", "us-west-2")
}
// Note: the test secrets are referenced in
// org.apache.polaris.service.it.ServerManager
environment("POLARIS_BOOTSTRAP_CREDENTIALS", "POLARIS,test-admin,test-secret")
jvmArgs("--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED")
// Need to allow a java security manager after Java 21, for Subject.getSubject to work
// "getSubject is supported only if a security manager is allowed".
systemProperty("java.security.manager", "allow")
}

listOf("intTest", "cloudTest")
.map { tasks.named<Test>(it) }
.forEach {
it.configure {
maxParallelForks = 1

val logsDir = project.layout.buildDirectory.get().asFile.resolve("logs")

// JVM arguments provider does not interfere with Gradle's cache keys
jvmArgumentProviders.add(
CommandLineArgumentProvider {
// Same issue as above: allow a java security manager after Java 21
// (this setting is for the application under test, while the setting above is for test
// code).
val securityManagerAllow = "-Djava.security.manager=allow"

val args = mutableListOf<String>()

// Example: to attach a debugger to the spawned JVM running Quarkus, add
// -Dquarkus.test.arg-line=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
// to your test configuration.
val explicitQuarkusTestArgLine = System.getProperty("quarkus.test.arg-line")
var quarkusTestArgLine =
if (explicitQuarkusTestArgLine != null)
"$explicitQuarkusTestArgLine $securityManagerAllow"
else securityManagerAllow

args.add("-Dquarkus.test.arg-line=$quarkusTestArgLine")
// This property is not honored in a per-profile application.properties file,
// so we need to set it here.
args.add("-Dquarkus.log.file.path=${logsDir.resolve("polaris.log").absolutePath}")

// Add `quarkus.*` system properties, other than the ones explicitly set above
System.getProperties()
.filter {
it.key.toString().startsWith("quarkus.") &&
!"quarkus.test.arg-line".equals(it.key) &&
!"quarkus.log.file.path".equals(it.key)
}
.forEach { args.add("${it.key}=${it.value}") }

args
}
)
// delete files from previous runs
doFirst {
// delete log files written by Polaris
logsDir.deleteRecursively()
// delete quarkus.log file (captured Polaris stdout/stderr)
project.layout.buildDirectory.get().asFile.resolve("quarkus.log").delete()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogAdlsIntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogGcsIntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogS3IntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogViewAdlsIntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogViewGcsIntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogViewS3IntegrationTestBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisApplicationIntegrationTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisManagementServiceIntegrationTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import com.google.common.collect.ImmutableMap;
import io.quarkus.test.junit.QuarkusIntegrationTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisPolicyServiceIntegrationTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.polaris.service.it.test.PolarisRestCatalogFileIntegrationTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.iceberg.CatalogProperties.TABLE_DEFAULT_PREFIX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it;
package org.apache.polaris.server.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import java.lang.reflect.Field;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it.relational.jdbc;
package org.apache.polaris.server.it.relational.jdbc;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it.relational.jdbc;
package org.apache.polaris.server.it.relational.jdbc;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it.relational.jdbc;
package org.apache.polaris.server.it.relational.jdbc;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it.relational.jdbc;
package org.apache.polaris.server.it.relational.jdbc;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.polaris.service.it.relational.jdbc;
package org.apache.polaris.server.it.relational.jdbc;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.TestProfile;
Expand Down
25 changes: 0 additions & 25 deletions runtime/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,3 @@

## Overview
The `polaris-runtime-service` module is the core runtime service implementation of Apache Polaris. It serves as the main service layer that provides the REST API endpoints and business logic.

## Integration tests

Integration tests from the :polaris-tests module can be run against a local Polaris Quarkus instance
for each supported cloud storage. Set the appropriate environment variables for your target cloud,
then run the tests as shown below.

For S3:
```shell
export INTEGRATION_TEST_S3_PATH="s3://bucket/subpath"
export INTEGRATION_TEST_S3_ROLE_ARN="your-role-arn"
./gradlew :polaris-runtime-service:cloudTest
```
For ADLS:
```shell
export INTEGRATION_TEST_AZURE_PATH="abfss://bucket/subpath"
export INTEGRATION_TEST_AZURE_TENANT_ID="your-tenant-id"
./gradlew :polaris-runtime-service:cloudTest
```
For GCS:
```shell
export INTEGRATION_TEST_GCS_PATH="gs://bucket/subpath"
export INTEGRATION_TEST_GCS_SERVICE_ACCOUNT="your-service-account"
./gradlew :polaris-runtime-service:cloudTest
```
Loading
Loading