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

[WIP] Graalvm native integration tests #1226

Closed
wants to merge 13 commits into from
Closed
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 .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Run all checks'
if: ${{steps.changed-files.outputs.ONLY_DOCS && steps.changed-files.outputs.ONLY_DOCS == 'false'}}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Build Driver'
run: |
./gradlew --no-parallel --no-daemon -x test build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Build Driver'
run: |
./gradlew --no-parallel --no-daemon -x test build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql_advanced_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pg_advanced_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pg_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Build Driver'
run: |
./gradlew --no-parallel --no-daemon -x test build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-autoscaling-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-hibernate-orm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Run Hibernate ORM integration tests'
if: ${{steps.changed-files.outputs.ONLY_DOCS && steps.changed-files.outputs.ONLY_DOCS == 'false'}}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-integration-tests-codebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-integration-tests-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-integration-tests-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Configure AWS credentials'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-standard-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 8
java-version: 11
- name: 'Run standard integration tests'
if: ${{steps.changed-files.outputs.ONLY_DOCS && steps.changed-files.outputs.ONLY_DOCS == 'false'}}
run: |
Expand Down
9 changes: 5 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
`kotlin-dsl`
Expand All @@ -39,8 +40,8 @@ tasks {
}
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
1 change: 1 addition & 0 deletions reachability/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metadata-output/*
6 changes: 6 additions & 0 deletions reachability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Instructions

1. Download GraalVM 21 and set your environment variables to use it as your java version.
2. Navigate into this directory (eg `cd path/to/project/aws-advanced-jdbc-wrapper/reachability`).
3. Execute `../gradlew nativeCompile` to create the native image.
4. Execute `./build/native/nativeCompile/reachability` to run the native image.
52 changes: 52 additions & 0 deletions reachability/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id("java")
id("org.graalvm.buildtools.native") version "0.10.4"
application
}

group = "reachability.software.amazon.jdbc"
version = "2.5.3"

repositories {
mavenCentral()
gradlePluginPortal()
}

application {
mainClass.set("reachability.software.amazon.jdbc.Main")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

dependencies {
implementation(project(":aws-advanced-jdbc-wrapper"))
// TODO: does graalvm only have reachability data for 42.7.3, or for all versions past 42.3.4?
// https://github.com/oracle/graalvm-reachability-metadata/tree/master/metadata/org.postgresql/postgresql/42.7.3
// https://www.graalvm.org/native-image/libraries-and-frameworks/#footnote-1
implementation("org.postgresql:postgresql:42.7.3")
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
implementation("software.amazon.awssdk:secretsmanager:2.28.11")
implementation("com.zaxxer:HikariCP:4.0.3")
implementation("software.amazon.awssdk:sts:2.27.22")
implementation("org.jsoup:jsoup:1.18.1")
implementation("mysql:mysql-connector-java:8.0.33")
implementation("org.mariadb.jdbc:mariadb-java-client:3.1.0")
}

tasks.compileJava {
dependsOn(":aws-advanced-jdbc-wrapper:compileTestJava")
}

graalvmNative {
toolchainDetection.set(true)
metadataRepository {
enabled.set(true)
}
binaries.all {
resources.autodetect()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package reachability.software.amazon.jdbc;

import software.amazon.jdbc.util.StringUtils;

public class ClusterDetails {
public String endpoint = System.getenv("CLUSTER_ENDPOINT");
public String region = System.getenv("CLUSTER_REGION");
public String iamUser = System.getenv("IAM_USER");
public String username = System.getenv("CLUSTER_USERNAME");
public String password = System.getenv("CLUSTER_PASSWORD");
public String databaseName = System.getenv("CLUSTER_DATABASE_NAME");

public ClusterDetails() {}

@Override
public String toString() {
return String.format("%s: endpoint=%s, region=%s, iamUser=%s, username=%s, password=%s, databaseName=%s",
super.toString(), this.endpoint, this.region, this.iamUser, this.username,
StringUtils.isNullOrEmpty(this.password) ? "<empty>" : "<masked>", this.databaseName);
}
}
Loading
Loading