Skip to content

Commit 0b5cf78

Browse files
committed
Support AlloyDB (#3029)
1 parent 4601164 commit 0b5cf78

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,138 @@ jobs:
17411741
name: db2_12.1_integration_test_reports_${{ matrix.mode.label }}
17421742
path: core/build/reports/tests/integrationTestJdbc
17431743

1744+
integration-test-for-alloydb-15:
1745+
name: AlloyDB 15 integration test (${{ matrix.mode.label }})
1746+
runs-on: ubuntu-latest
1747+
1748+
services:
1749+
alloydb:
1750+
image: google/alloydbomni:15
1751+
env:
1752+
POSTGRES_USER: postgres
1753+
POSTGRES_PASSWORD: postgres
1754+
POSTGRES_INITDB_ARGS: "--icu-locale=en-US-u-va-posix"
1755+
ports:
1756+
- 5432:5432
1757+
1758+
strategy:
1759+
fail-fast: false
1760+
matrix:
1761+
mode:
1762+
- label: default
1763+
group_commit_enabled: false
1764+
- label: with_group_commit
1765+
group_commit_enabled: true
1766+
1767+
steps:
1768+
- uses: actions/checkout@v4
1769+
1770+
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }})
1771+
uses: actions/setup-java@v4
1772+
with:
1773+
java-version: ${{ env.JAVA_VERSION }}
1774+
distribution: ${{ env.JAVA_VENDOR }}
1775+
1776+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test
1777+
uses: actions/setup-java@v4
1778+
if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}}
1779+
with:
1780+
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}
1781+
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}
1782+
1783+
- name: Login to Oracle container registry
1784+
uses: docker/login-action@v3
1785+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
1786+
with:
1787+
registry: container-registry.oracle.com
1788+
username: ${{ secrets.OCR_USERNAME }}
1789+
password: ${{ secrets.OCR_TOKEN }}
1790+
1791+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test
1792+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
1793+
run: |
1794+
container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}")
1795+
docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id"
1796+
1797+
- name: Setup Gradle
1798+
uses: gradle/actions/setup-gradle@v4
1799+
1800+
- name: Execute Gradle 'integrationTestJdbc' task
1801+
run: ./gradlew integrationTestJdbc -Dscalardb.jdbc.url=jdbc:postgresql://localhost:5432/ -Dscalardb.jdbc.username=postgres -Dscalardb.jdbc.password=postgres ${{ matrix.mode.group_commit_enabled && env.INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT || '' }}
1802+
1803+
- name: Upload Gradle test reports
1804+
if: always()
1805+
uses: actions/upload-artifact@v4
1806+
with:
1807+
name: alloydb_15_integration_test_reports_${{ matrix.mode.label }}
1808+
path: core/build/reports/tests/integrationTestJdbc
1809+
1810+
integration-test-for-alloydb-16:
1811+
name: AlloyDB 16 integration test (${{ matrix.mode.label }})
1812+
runs-on: ubuntu-latest
1813+
1814+
services:
1815+
alloydb:
1816+
image: google/alloydbomni:16
1817+
env:
1818+
POSTGRES_USER: postgres
1819+
POSTGRES_PASSWORD: postgres
1820+
POSTGRES_INITDB_ARGS: "--icu-locale=en-US-u-va-posix"
1821+
ports:
1822+
- 5432:5432
1823+
1824+
strategy:
1825+
fail-fast: false
1826+
matrix:
1827+
mode:
1828+
- label: default
1829+
group_commit_enabled: false
1830+
- label: with_group_commit
1831+
group_commit_enabled: true
1832+
1833+
steps:
1834+
- uses: actions/checkout@v4
1835+
1836+
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }})
1837+
uses: actions/setup-java@v4
1838+
with:
1839+
java-version: ${{ env.JAVA_VERSION }}
1840+
distribution: ${{ env.JAVA_VENDOR }}
1841+
1842+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test
1843+
uses: actions/setup-java@v4
1844+
if: ${{ env.SET_UP_INT_TEST_RUNTIME_NON_ORACLE_JDK == 'true'}}
1845+
with:
1846+
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}
1847+
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}
1848+
1849+
- name: Login to Oracle container registry
1850+
uses: docker/login-action@v3
1851+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
1852+
with:
1853+
registry: container-registry.oracle.com
1854+
username: ${{ secrets.OCR_USERNAME }}
1855+
password: ${{ secrets.OCR_TOKEN }}
1856+
1857+
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test
1858+
if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR == 'oracle' }}
1859+
run: |
1860+
container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}")
1861+
docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id"
1862+
1863+
- name: Setup Gradle
1864+
uses: gradle/actions/setup-gradle@v4
1865+
1866+
- name: Execute Gradle 'integrationTestJdbc' task
1867+
run: ./gradlew integrationTestJdbc -Dscalardb.jdbc.url=jdbc:postgresql://localhost:5432/ -Dscalardb.jdbc.username=postgres -Dscalardb.jdbc.password=postgres ${{ matrix.mode.group_commit_enabled && env.INT_TEST_GRADLE_OPTIONS_FOR_GROUP_COMMIT || '' }}
1868+
1869+
- name: Upload Gradle test reports
1870+
if: always()
1871+
uses: actions/upload-artifact@v4
1872+
with:
1873+
name: alloydb_16_integration_test_reports_${{ matrix.mode.label }}
1874+
path: core/build/reports/tests/integrationTestJdbc
1875+
17441876
integration-test-for-multi-storage:
17451877
name: Multi-storage integration test (${{ matrix.mode.label }})
17461878
runs-on: ubuntu-latest

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ subprojects {
3939
yugabyteDriverVersion = '42.7.3-yb-4'
4040
db2DriverVersion = '12.1.2.0'
4141
mariadDbDriverVersion = '3.5.6'
42+
alloyDbJdbcConnectorVersion = '1.2.6'
4243
picocliVersion = '4.7.7'
4344
commonsTextVersion = '1.14.0'
4445
junitVersion = '5.14.0'

core/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ dependencies {
173173
implementation ("org.mariadb.jdbc:mariadb-java-client:${mariadDbDriverVersion}") {
174174
exclude group: 'org.slf4j', module: 'slf4j-api'
175175
}
176+
// The Java connector library used to establish simply a secure connection to AlloyDB on GCP
177+
implementation("com.google.cloud:alloydb-jdbc-connector:${alloyDbJdbcConnectorVersion}")
176178
implementation "org.apache.commons:commons-text:${commonsTextVersion}"
177179
testImplementation platform("org.junit:junit-bom:${junitVersion}")
178180
testImplementation 'org.junit.jupiter:junit-jupiter'

0 commit comments

Comments
 (0)