[PECOBLR-145] Implement OAuth2RedirectUrlPort #569
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 JDBC Logging | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| jobs: | |
| test-logging: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| github-runner: [linux-ubuntu-latest, windows-server-latest] | |
| thrift-client: [0, 1] | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: ${{ matrix.github-runner }} | |
| steps: | |
| - name: Enable long paths | |
| if: runner.os == 'Windows' | |
| run: git config --system core.longpaths true | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '21' | |
| - name: Build JDBC driver | |
| run: mvn clean package -DskipTests | |
| - name: Set Environment Variables | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| env: | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_HTTP_PATH: ${{ secrets.DATABRICKS_HTTP_PATH }} | |
| USE_THRIFT_CLIENT: ${{ matrix.thrift-client }} | |
| run: | | |
| echo "DATABRICKS_TOKEN=${DATABRICKS_TOKEN}" >> $GITHUB_ENV | |
| echo "DATABRICKS_HOST=${DATABRICKS_HOST}" >> $GITHUB_ENV | |
| echo "DATABRICKS_HTTP_PATH=${DATABRICKS_HTTP_PATH}" >> $GITHUB_ENV | |
| echo "USE_THRIFT_CLIENT=${USE_THRIFT_CLIENT}" >> $GITHUB_ENV | |
| - name: Set Environment Variables (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| env: | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_HTTP_PATH: ${{ secrets.DATABRICKS_HTTP_PATH }} | |
| USE_THRIFT_CLIENT: ${{ matrix.thrift-client }} | |
| run: | | |
| "DATABRICKS_TOKEN=$env:DATABRICKS_TOKEN" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "DATABRICKS_HOST=$env:DATABRICKS_HOST" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "DATABRICKS_HTTP_PATH=$env:DATABRICKS_HTTP_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "USE_THRIFT_CLIENT=$env:USE_THRIFT_CLIENT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Clean & Compile LoggingTest | |
| shell: bash | |
| run: | | |
| rm -rf target/test-classes | |
| mkdir -p target/test-classes | |
| javac \ | |
| -cp "target/databricks-jdbc-1.0.2-oss.jar" \ | |
| -d target/test-classes \ | |
| src/test/java/com/databricks/client/jdbc/LoggingTest.java | |
| echo "==== Checking compiled classes ====" | |
| find target/test-classes -type f | |
| - name: Run LoggingTest | |
| shell: bash | |
| run: | | |
| echo "==== Running LoggingTest with usethriftclient=${{ matrix.thrift-client }} ====" | |
| OS_TYPE=$(uname | tr '[:upper:]' '[:lower:]') | |
| if [[ "$OS_TYPE" == "linux" ]]; then SEP=":"; else SEP=";"; fi | |
| echo "Using classpath separator: '$SEP'" | |
| CP="target/test-classes${SEP}target/databricks-jdbc-1.0.2-oss.jar" | |
| java \ | |
| --add-opens=java.base/java.nio=ALL-UNNAMED \ | |
| -cp "$CP" \ | |
| com.databricks.client.jdbc.LoggingTest | |
| - name: Verify log file contents | |
| shell: bash | |
| run: | | |
| LOG_DIR="${HOME}/logstest" | |
| LOG_FILE="${LOG_DIR}/databricks_jdbc.log.0" | |
| echo "Verifying log file contents in ${LOG_FILE}..." | |
| if [ -f "$LOG_FILE" ]; then | |
| echo "Log file found. Checking contents..." | |
| REQUIRED_STRINGS=("Executing HTTP request" | |
| "Result retrieved successfully" | |
| "Closing global async HTTP client" | |
| "Global async HTTP client has been shut down") | |
| for STRING in "${REQUIRED_STRINGS[@]}"; do | |
| if ! grep -qF "$STRING" "$LOG_FILE"; then | |
| echo "ERROR: Required log string not found: $STRING" | |
| echo "Showing last 100 lines of log file:" | |
| tail -n 100 "$LOG_FILE" | |
| exit 1 | |
| fi | |
| done | |
| echo "All required log strings were found." | |
| else | |
| echo "Log file directory contents:" | |
| ls -la "${LOG_DIR}" || echo "Directory does not exist" | |
| echo "Log file ${LOG_FILE} does not exist. Failing the build." | |
| exit 1 | |
| fi |