Skip to content

Read-Replica Integration Tests #1

Read-Replica Integration Tests

Read-Replica Integration Tests #1

name: Read-Replica Integration Tests
on:
pull_request:
types: [labeled, synchronize, opened, reopened, ready_for_review]
# Cancel running tests for previous commits on the same PR to save time/resources
concurrency:
group: read-replica-tests-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
read-replica-integration-test:
# Trigger only if the 'read-replica' label is attached and the PR is not a draft
if: ${{ contains(github.event.pull_request.labels.*.name, 'read-replica') && !github.event.pull_request.draft }}
env:
REPLICA_BASE_DIR: ./dev-support/integration-test/read-replica
defaults:
run:
# Change default working directory from GITHUB_WORKSPACE to this
working-directory: ${{ env.REPLICA_BASE_DIR }}
runs-on: ubuntu-latest
steps:
- name: Checkout HBase Repository with Pull Request's SHA
uses: actions/checkout@v4
- name: Checkout HBase Respoitory Again Inside read-replica Directory
uses: actions/checkout@v4
with:
# Place repo inside dev-support/integration-test/read-replica
# Use this repo to build the hbase-docker image
path: ${{ env.REPLICA_BASE_DIR }}/hbase
- name: Show Working Directory
run: |
echo "The previous default working directory was: GITHUB_WORKSPACE=${GITHUB_WORKSPACE}"
echo "The current and default working directory is now: $(pwd)"
echo "The working directory now has an HBase repo:"
ls -la
echo "Showing the most recent commit in this HBase repo:"
cd hbase && git log --oneline | head
- name: Load .env File into GitHub Actions Environment
run: |
# Turn on auto-export and source the file
set -a
source .env
set +a
# Filter out comments, grab the keys, and write the expanded values to GITHUB_ENV
grep -E "^[A-Za-z0-9_]+=" .env | cut -d= -f1 | while read -r key; do
echo "$key=${!key}"
echo "$key=${!key}" >> $GITHUB_ENV
done
- name: Set up Docker Compose
uses: docker/setup-compose-action@v2
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- name: Set Python Path
run: |
echo "Setting PYTHONPATH=$(pwd) for GITHUB_ENV=${GITHUB_ENV}"
echo "PYTHONPATH=$(pwd)" >> ${GITHUB_ENV}
- name: Compile Protobuf
run: |
echo "Copying ActiveClusterSuffix.proto from HBase repo to have latest version"
cp hbase/hbase-protocol-shaded/src/main/protobuf/server/ActiveClusterSuffix.proto \
python/proto
python3 python/proto/proto_compiler.py
- name: Build Docker Image
run: |
echo "Building docker image"
./build-images.sh
echo "Listing Docker images"
docker image ls
- name: Verify Can't Start Two Active Clusters at Once
run: |
# This script automatically prepares the HBASE_DATA_STORE_ROOT defined in .env.
# This directory and its sub-directories need 777 permissions to prevent HBase
# from failing on startup. The directories are deleted when the containers are stopped
python3 python/scripts/test_dual_active_cluster_startup.py --clean-up-containers
- name: Properly Start HBase Docker Containers
run: |
# This script also prepares HBASE_DATA_STORE_ROOT, similar to the previous step
echo "Starting one active and one replica HBase cluster and waiting for them to initialize..."
python3 python/scripts/verify_hbase_start.py
- name: Test Table Create/Drop Behavior
run: python3 python/scripts/test_create_drop_behavior.py --skip-table-cleanup-on-start
- name: Test Put/Get/Delete Behavior
run: python3 python/scripts/test_put_get_delete_behavior.py --skip-table-cleanup-on-start
- name: Test Read-Only Flag Flipping
run: |
python3 python/scripts/test_read_only_flag_flipping.py --skip-container-start-or-restart
- name: Test Cannot Promote Replica to Second Active Cluster
run: |
python3 python/scripts/test_cannot_promote_second_active_cluster.py --skip-container-start-or-restart
- name: Test Bulkloaded Data and Region Splitting
run: |
python3 python/scripts/test_bulkloaded_data_and_region_splits.py --skip-container-start-or-restart
- name: Clean up
run: docker compose -f docker-compose.yml down
- name: Dump Logs on Failure
if: failure()
run: |
docker logs hbase-docker
docker logs hbase-docker-2