Test Spanner Adapter : JDK () #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Spanner Adapter | |
| run-name: "Test Spanner Adapter : JDK ${{ inputs.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ inputs.INT_TEST_JAVA_RUNTIME_VENDOR }})" | |
| on: | |
| # TODO: remove push trigger after initial validation | |
| push: | |
| branches: | |
| - spanner_support | |
| paths: | |
| - '.github/workflows/spanner-adapter-check.yaml' | |
| workflow_dispatch: | |
| inputs: | |
| INT_TEST_JAVA_RUNTIME_VERSION: | |
| description: JDK version used to run the integration test | |
| type: choice | |
| default: '8' | |
| options: | |
| - '8' | |
| - '11' | |
| - '17' | |
| - '21' | |
| INT_TEST_JAVA_RUNTIME_VENDOR: | |
| description: Vendor of the JDK used to run the integration test | |
| type: choice | |
| default: 'temurin' | |
| options: | |
| - 'corretto' | |
| - 'microsoft' | |
| - 'oracle' | |
| - 'temurin' | |
| env: | |
| ARTIFACT_SUFFIX: ${{ inputs.INT_TEST_JAVA_RUNTIME_VERSION || '8' }}_${{ inputs.INT_TEST_JAVA_RUNTIME_VENDOR || 'temurin' }} | |
| INT_TEST_JAVA_RUNTIME_VERSION: ${{ inputs.INT_TEST_JAVA_RUNTIME_VERSION || '8' }} | |
| INT_TEST_JAVA_RUNTIME_VENDOR: ${{ inputs.INT_TEST_JAVA_RUNTIME_VENDOR || 'temurin' }} | |
| SPANNER_JDBC_URL: "jdbc:cloudspanner://localhost:9010/projects/emulator-project/instances/test-instance/databases/test-db;autoConfigEmulator=true;dialect=POSTGRESQL" | |
| # Test groups based on Phase 4 execution durations: | |
| # | |
| # Dedicated runners for slow tests: | |
| # - ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestWithJdbcDatabase: 68m 50s | |
| # - JdbcAdminIntegrationTest: 45m | |
| # - ConsensusCommitSpecificIntegrationTestWithJdbcDatabaseInHighestIsolation: 17m | |
| # - ConsensusCommitSpecificIntegrationTestWithJdbcDatabase: 16m | |
| # - JdbcDatabaseMultipleClusteringKeyScanIntegrationTest: timed out (>10m) | |
| # - JdbcDatabaseConditionalMutationIntegrationTest: ~5m (dedicated due to emulator sensitivity) | |
| # | |
| # Group 1 (~26m): Admin and import tests | |
| # Group 2 (~12m): Core JDBC database tests | |
| # Group 3 (~25m): Schema, i18n, virtual tables | |
| # Group 4 (~15m): ConsensusCommit base + TwoPhase + SingleCrud | |
| jobs: | |
| spanner-integration-test: | |
| name: "${{ matrix.test_group.name }} (${{ matrix.group_commit_enabled == 'true' && 'group_commit' || 'default' }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| group_commit_enabled: | |
| - 'false' | |
| - 'true' | |
| test_group: | |
| # --- Dedicated runners for slow tests --- | |
| - name: JdbcAdminIntegrationTest | |
| label: spanner_admin | |
| tests: "JdbcAdminIntegrationTest" | |
| - name: ConsensusCommitSpecific | |
| label: spanner_cc_specific | |
| tests: "ConsensusCommitSpecificIntegrationTestWithJdbcDatabase" | |
| - name: ConsensusCommitSpecific (highest isolation) | |
| label: spanner_cc_specific_highest | |
| tests: "ConsensusCommitSpecificIntegrationTestWithJdbcDatabaseInHighestIsolation" | |
| - name: ConsensusCommitSpecific (metadata decoupling) | |
| label: spanner_cc_specific_md | |
| tests: "ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestWithJdbcDatabase" | |
| - name: MultipleClusteringKeyScan | |
| label: spanner_multi_ck_scan | |
| tests: "JdbcDatabaseMultipleClusteringKeyScanIntegrationTest" | |
| - name: ConditionalMutation | |
| label: spanner_cond_mutation | |
| tests: "JdbcDatabaseConditionalMutationIntegrationTest" | |
| # --- Group 1: Admin and import tests (~26m) --- | |
| - name: "Admin & Import" | |
| label: spanner_group1 | |
| tests: >- | |
| ConsensusCommitAdminIntegrationTestWithJdbcDatabase | |
| ConsensusCommitAdminRepairIntegrationTestWithJdbcDatabase | |
| ConsensusCommitAdminImportTableIntegrationTestWithJdbcDatabase | |
| ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase | |
| ConsensusCommitImportTableIntegrationTestWithJdbcDatabase | |
| ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase | |
| JdbcAdminImportTableIntegrationTest | |
| JdbcAdminRepairIntegrationTest | |
| JdbcSchemaLoaderImportIntegrationTest | |
| JdbcSchemaLoaderImportWithMetadataDecouplingIntegrationTest | |
| # --- Group 2: Core JDBC database tests (~12m) --- | |
| - name: "Core JDBC" | |
| label: spanner_group2 | |
| tests: >- | |
| JdbcDatabaseIntegrationTest | |
| JdbcDatabaseColumnValueIntegrationTest | |
| JdbcDatabaseCrossPartitionScanIntegrationTest | |
| JdbcDatabaseSingleClusteringKeyScanIntegrationTest | |
| JdbcDatabaseSinglePartitionKeyIntegrationTest | |
| JdbcDatabaseMultiplePartitionKeyIntegrationTest | |
| JdbcDatabaseSecondaryIndexIntegrationTest | |
| # --- Group 3: Schema, i18n, virtual tables (~25m) --- | |
| - name: "Schema & i18n" | |
| label: spanner_group3 | |
| tests: >- | |
| JdbcDatabaseJapaneseIntegrationTest | |
| JdbcDatabaseCaseSensitivityIntegrationTest | |
| JdbcDatabaseWithReservedKeywordIntegrationTest | |
| JdbcDatabaseVirtualTablesIntegrationTest | |
| JdbcDatabaseMutationAtomicityUnitIntegrationTest | |
| JdbcAdminCaseSensitivityIntegrationTest | |
| JdbcSchemaLoaderIntegrationTest | |
| JdbcSchemaLoaderWithMetadataDecouplingIntegrationTest | |
| # --- Group 4: ConsensusCommit base + TwoPhase + SingleCrud (~15m) --- | |
| - name: "CC base & TwoPhase & SingleCrud" | |
| label: spanner_group4 | |
| tests: >- | |
| ConsensusCommitIntegrationTestWithJdbcDatabase | |
| ConsensusCommitIntegrationTestWithJdbcDatabaseInHighestIsolation | |
| ConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase | |
| ConsensusCommitNullMetadataIntegrationTestWithJdbcDatabase | |
| ConsensusCommitWithIncludeMetadataEnabledIntegrationTestWithJdbcDatabase | |
| ConsensusCommitWithMetadataDecouplingIntegrationTestWithJdbcDatabase | |
| TwoPhaseConsensusCommitIntegrationTestWithJdbcDatabase | |
| TwoPhaseConsensusCommitSpecificIntegrationTestWithJdbcDatabase | |
| TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase | |
| TwoPhaseConsensusCommitWithIncludeMetadataEnabledIntegrationTestWithJdbcDatabase | |
| SingleCrudOperationTransactionIntegrationTestWithJdbcDatabase | |
| SingleCrudOperationTransactionAdminIntegrationTestWithJdbcDatabase | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Spanner emulator | |
| run: | | |
| echo "deb [signed-by=/usr/share/keyrings/cloud.google.asc] https://packages.cloud.google.com/apt cloud-sdk main" \ | |
| | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list | |
| curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg \ | |
| | sudo tee /usr/share/keyrings/cloud.google.asc > /dev/null | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq google-cloud-cli-spanner-emulator | |
| - name: Start Spanner emulator | |
| run: | | |
| EMULATOR_DIR=/usr/lib/google-cloud-sdk/bin/cloud_spanner_emulator | |
| ${EMULATOR_DIR}/gateway_main \ | |
| --hostname 0.0.0.0 \ | |
| --grpc_port 9010 \ | |
| --http_port 9020 \ | |
| --grpc_binary ${EMULATOR_DIR}/emulator_main \ | |
| & | |
| - name: Wait for Spanner emulator to be ready | |
| run: | | |
| SECONDS=0 | |
| until curl -sf http://localhost:9020/v1/projects/emulator-project/instances > /dev/null 2>&1; do | |
| if (( SECONDS > 60 )); then | |
| echo "Timeout: Spanner emulator failed to start within 60 seconds" | |
| exit 1 | |
| fi | |
| echo "Waiting for Spanner emulator..." | |
| sleep 2 | |
| done | |
| echo "Spanner emulator is ready" | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 8 | |
| distribution: temurin | |
| - name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test | |
| id: setup-int-test-jdk | |
| uses: actions/setup-java@v5 | |
| if: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR != 'oracle' }} | |
| with: | |
| java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} | |
| distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }} | |
| - name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (oracle) to run the integration test | |
| if: ${{ steps.setup-int-test-jdk.outcome == 'skipped' }} | |
| run: | | |
| echo ${{ secrets.OCR_TOKEN }} | docker login container-registry.oracle.com -u ${{ secrets.OCR_USERNAME }} --password-stdin | |
| container_id=$(docker create "container-registry.oracle.com/java/jdk:${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}") | |
| docker cp -L "$container_id:/usr/java/default" /usr/lib/jvm/oracle-jdk && docker rm "$container_id" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Run integration test | |
| id: run-integration-test | |
| env: | |
| ORG_GRADLE_PROJECT_javaVersion: '8' | |
| ORG_GRADLE_PROJECT_javaVendor: 'temurin' | |
| ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVersion: "${{ env.INT_TEST_JAVA_RUNTIME_VERSION }}" | |
| ORG_GRADLE_PROJECT_integrationTestJavaRuntimeVendor: "${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}" | |
| run: | | |
| # Build the --tests arguments from the space-separated test list | |
| TESTS_ARGS="" | |
| for test_class in ${{ matrix.test_group.tests }}; do | |
| TESTS_ARGS="${TESTS_ARGS} --tests ${test_class}" | |
| done | |
| # Group commit options (only applied to ConsensusCommit tests) | |
| GROUP_COMMIT_OPTS="" | |
| if [ "${{ matrix.group_commit_enabled }}" = "true" ]; then | |
| GROUP_COMMIT_OPTS="-Dscalardb.consensus_commit.coordinator.group_commit.enabled=true -Dscalardb.consensus_commit.coordinator.group_commit.old_group_abort_timeout_millis=15000" | |
| fi | |
| ./gradlew core:integrationTestJdbc \ | |
| "-Dscalardb.jdbc.url=${{ env.SPANNER_JDBC_URL }}" \ | |
| ${GROUP_COMMIT_OPTS} \ | |
| ${TESTS_ARGS} | |
| - name: Upload binary test results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results_${{ matrix.test_group.label }}_${{ matrix.group_commit_enabled == 'true' && 'group_commit' || 'default' }} | |
| path: core/build/test-results/integrationTestJdbc/ | |
| aggregate-report: | |
| if: always() | |
| name: "Aggregate report (${{ matrix.flavor }})" | |
| runs-on: ubuntu-latest | |
| needs: | |
| - spanner-integration-test | |
| strategy: | |
| matrix: | |
| flavor: | |
| - default | |
| - group_commit | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 8 | |
| distribution: temurin | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Download all ${{ matrix.flavor }} test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: test-results_*_${{ matrix.flavor }} | |
| path: downloaded-results/ | |
| - name: Generate aggregated HTML report | |
| run: | | |
| # Create an init script that registers an aggregate TestReport task | |
| cat > /tmp/aggregate-init.gradle << 'EOF' | |
| import org.gradle.api.tasks.testing.TestReport | |
| rootProject { | |
| tasks.register('aggregateTestReport', TestReport) { | |
| destinationDirectory = layout.buildDirectory.dir('reports/tests/aggregated') | |
| def resultsDir = file("${rootDir}/downloaded-results") | |
| resultsDir.eachDirRecurse { dir -> | |
| if (dir.name == 'binary') { | |
| testResults.from(dir) | |
| } | |
| } | |
| } | |
| } | |
| EOF | |
| ./gradlew -I /tmp/aggregate-init.gradle aggregateTestReport | |
| - name: Upload aggregated HTML report | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: spanner_ci_${{ matrix.flavor }}_report_${{ env.ARTIFACT_SUFFIX }}_run_#${{ github.run_attempt }} | |
| path: build/reports/tests/aggregated/ |