|
| 1 | +name: Read-Replica Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled, synchronize, opened, reopened, ready_for_review] |
| 6 | + |
| 7 | +# Cancel running tests for previous commits on the same PR to save time/resources |
| 8 | +concurrency: |
| 9 | + group: read-replica-tests-${{ github.event.pull_request.number }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + read-replica-integration-test: |
| 14 | + # Trigger only if the 'read-replica' label is attached and the PR is not a draft |
| 15 | + if: ${{ contains(github.event.pull_request.labels.*.name, 'read-replica') && !github.event.pull_request.draft }} |
| 16 | + env: |
| 17 | + REPLICA_BASE_DIR: ./dev-support/integration-test/read-replica |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + # Change default working directory from GITHUB_WORKSPACE to this |
| 21 | + working-directory: ${{ env.REPLICA_BASE_DIR }} |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Checkout HBase Repository with Pull Request's SHA |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Checkout HBase Respoitory Again Inside read-replica Directory |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + # Place repo inside dev-support/integration-test/read-replica |
| 31 | + # Use this repo to build the hbase-docker image |
| 32 | + path: ${{ env.REPLICA_BASE_DIR }}/hbase |
| 33 | + |
| 34 | + - name: Show Working Directory |
| 35 | + run: | |
| 36 | + echo "The previous default working directory was: GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" |
| 37 | + echo "The current and default working directory is now: $(pwd)" |
| 38 | + echo "The working directory now has an HBase repo:" |
| 39 | + ls -la |
| 40 | + echo "Showing the most recent commit in this HBase repo:" |
| 41 | + cd hbase && git log --oneline | head |
| 42 | +
|
| 43 | + - name: Load .env File into GitHub Actions Environment |
| 44 | + run: | |
| 45 | + # Turn on auto-export and source the file |
| 46 | + set -a |
| 47 | + source .env |
| 48 | + set +a |
| 49 | +
|
| 50 | + # Filter out comments, grab the keys, and write the expanded values to GITHUB_ENV |
| 51 | + grep -E "^[A-Za-z0-9_]+=" .env | cut -d= -f1 | while read -r key; do |
| 52 | + echo "$key=${!key}" |
| 53 | + echo "$key=${!key}" >> $GITHUB_ENV |
| 54 | + done |
| 55 | +
|
| 56 | + - name: Set up Docker Compose |
| 57 | + uses: docker/setup-compose-action@v2 |
| 58 | + |
| 59 | + - name: Install Python Requirements |
| 60 | + run: | |
| 61 | + pip install -r requirements.txt |
| 62 | +
|
| 63 | + - name: Set Python Path |
| 64 | + run: | |
| 65 | + echo "Setting PYTHONPATH=$(pwd) for GITHUB_ENV=${GITHUB_ENV}" |
| 66 | + echo "PYTHONPATH=$(pwd)" >> ${GITHUB_ENV} |
| 67 | +
|
| 68 | + - name: Compile Protobuf |
| 69 | + run: | |
| 70 | + echo "Copying ActiveClusterSuffix.proto from HBase repo to have latest version" |
| 71 | + cp hbase/hbase-protocol-shaded/src/main/protobuf/server/ActiveClusterSuffix.proto \ |
| 72 | + python/proto |
| 73 | + python3 python/proto/proto_compiler.py |
| 74 | +
|
| 75 | + - name: Build Docker Image |
| 76 | + run: | |
| 77 | + echo "Building docker image" |
| 78 | + ./build-images.sh |
| 79 | + echo "Listing Docker images" |
| 80 | + docker image ls |
| 81 | +
|
| 82 | + - name: Verify Can't Start Two Active Clusters at Once |
| 83 | + run: | |
| 84 | + # This script automatically prepares the HBASE_DATA_STORE_ROOT defined in .env. |
| 85 | + # This directory and its sub-directories need 777 permissions to prevent HBase |
| 86 | + # from failing on startup. The directories are deleted when the containers are stopped |
| 87 | + python3 python/scripts/test_dual_active_cluster_startup.py --clean-up-containers |
| 88 | +
|
| 89 | + - name: Properly Start HBase Docker Containers |
| 90 | + run: | |
| 91 | + # This script also prepares HBASE_DATA_STORE_ROOT, similar to the previous step |
| 92 | + echo "Starting one active and one replica HBase cluster and waiting for them to initialize..." |
| 93 | + python3 python/scripts/verify_hbase_start.py |
| 94 | +
|
| 95 | + - name: Test Table Create/Drop Behavior |
| 96 | + run: python3 python/scripts/test_create_drop_behavior.py --skip-table-cleanup-on-start |
| 97 | + |
| 98 | + - name: Test Put/Get/Delete Behavior |
| 99 | + run: python3 python/scripts/test_put_get_delete_behavior.py --skip-table-cleanup-on-start |
| 100 | + |
| 101 | + - name: Test Read-Only Flag Flipping |
| 102 | + run: | |
| 103 | + python3 python/scripts/test_read_only_flag_flipping.py --skip-container-start-or-restart |
| 104 | +
|
| 105 | + - name: Test Cannot Promote Replica to Second Active Cluster |
| 106 | + run: | |
| 107 | + python3 python/scripts/test_cannot_promote_second_active_cluster.py --skip-container-start-or-restart |
| 108 | +
|
| 109 | + - name: Test Bulkloaded Data and Region Splitting |
| 110 | + run: | |
| 111 | + python3 python/scripts/test_bulkloaded_data_and_region_splits.py --skip-container-start-or-restart |
| 112 | +
|
| 113 | + - name: Clean up |
| 114 | + run: docker compose -f docker-compose.yml down |
| 115 | + |
| 116 | + - name: Dump Logs on Failure |
| 117 | + if: failure() |
| 118 | + run: | |
| 119 | + docker logs hbase-docker |
| 120 | + docker logs hbase-docker-2 |
0 commit comments