Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] Add smoke test for cloud mode #545

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,43 @@ jobs:
- name: Run smoke test - dbt
run: |
./integration_tests/dbt/smoke_test.sh

smoke-test-cloud:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
include:
- python-version: "3.11"
dbt-version: "1.8"
- python-version: "3.11"
dbt-version: "latest"
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: setup.py
- run: |
python -m pip install --upgrade pip
if [ "${{ matrix.dbt-version }}" == "latest" ]; then
pip install dbt-core
pip install dbt-duckdb
else
pip install dbt-core~=${{ matrix.dbt-version }}.0
pip install dbt-duckdb~=${{ matrix.dbt-version }}.0
fi

- name: Install Recce
run: |
pip install .

- name: Run smoke test - dbt
run: |
./integration_tests/dbt/smoke_test_cloud.sh
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.RECCE_CLOUD_TOKEN }}
RECCE_STATE_PASSWORD: ${{ vars.RECCE_STATE_PASSWORD}}
11 changes: 4 additions & 7 deletions integration_tests/dbt/smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,22 @@ function check_server_status() {
if timeout 20 bash -c 'until curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/api/info | grep -q 200; do
echo "Server not ready yet..."
sleep 2
done'; then
done'; then
echo "Server is up and running."
EXITCODE=0
else
echo "Failed to start the server within the time limit."
EXITCODE=1
exit 1
fi

echo "Stopping the server..."
kill $(jobs -p) || true
echo "Server stopped."

exit $EXITCODE
}

echo "Starting the server..."
recce server &
check_server_status

echo "Starting the server (review mode)"
echo "Starting the server (review mode)..."
recce server --review recce_state.json &
check_server_status
check_server_status
70 changes: 70 additions & 0 deletions integration_tests/dbt/smoke_test_cloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
set -euo pipefail

NEW_WORKSPACE=$(dirname "$GITHUB_WORKSPACE")
cd "$NEW_WORKSPACE" || exit
pwd

# Clone jaffle_shop_duckdb
GIT_REPO="https://github.com/DataRecce/jaffle_shop_duckdb.git"
GIT_BRANCH="chore/smoke-test-cloud"

git clone --depth 1 --branch $GIT_BRANCH $GIT_REPO
cd jaffle_shop_duckdb || exit

# Prepare dbt artifacts
dbt --version
dbt deps
dbt seed
dbt run
dbt docs generate

mkdir -p ~/.recce
echo "user_id: 00000000000000000000000000000000" > ~/.recce/profile.yml
echo "anonymous_tracking: false" >> ~/.recce/profile.yml

# Hide PR information from GitHub Action
HOLD_GITHUB_EVENT_PATH="$GITHUB_EVENT_PATH"
unset GITHUB_EVENT_PATH

# Recce artifacts
recce cloud upload-artifacts --branch $GIT_BRANCH
rm -rf target

recce cloud download-base-artifacts --branch $GIT_BRANCH
recce cloud download-artifacts --branch $GIT_BRANCH

# Recce Run
recce run --cloud

# Recce state
recce cloud download
recce cloud purge --force
recce cloud upload recce_state.json

# Recce Summary
recce summary --cloud

function check_server_status() {
echo "Waiting for the server to respond..."
if timeout 20 bash -c 'until curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/api/info | grep -q 200; do
echo "Server not ready yet..."
sleep 2
done'; then
echo "Server is up and running."
else
echo "Failed to start the server within the time limit."
exit 1
fi

echo "Stopping the server..."
kill $(jobs -p) || true
echo "Server stopped."
}

# Recce Server
echo "Starting the server (cloud and review mode)..."
recce server --cloud --review &
check_server_status

export GITHUB_EVENT_PATH="$HOLD_GITHUB_EVENT_PATH"
Loading