Live Integration Tests
This document describes BenchBox’s live integration test suite that executes real benchmarks against cloud database platforms using actual credentials.
Overview
Live integration tests verify that BenchBox works correctly with real cloud databases by:
- Connecting to actual Databricks, Snowflake, BigQuery, Redshift, and Athena instances
- Creating test schemas and loading data
- Executing queries and verifying results
- Cleaning up test resources
Important: These tests are skipped by default and only run when credentials are available.
Prerequisites
General Requirements
- BenchBox installed with cloud platform extras:
pip install "benchbox[cloud]" - Active cloud platform accounts with appropriate permissions
- Environment variables configured with credentials
Cost Considerations
All tests use scale_factor=0.01 (~10MB of data) to minimize costs:
- Databricks: <$0.05 per test run (SQL Warehouse usage)
- Snowflake: <$0.05 per test run (Warehouse credit usage)
- BigQuery: <$0.10 per test run (Storage + query processing)
Total estimated cost: <$0.20 per full test run across all platforms
Setup Instructions
1. Create Environment File
Copy the template and fill in your credentials:
cp .env.example .env2. Configure Credentials
Edit .env and add credentials for the platforms you want to test:
Databricks
DATABRICKS_HOST=your-workspace.cloud.databricks.comDATABRICKS_HTTP_PATH=/sql/1.0/warehouses/your-warehouse-idDATABRICKS_TOKEN=your-access-tokenHow to get Databricks credentials:
- Log into your Databricks workspace
- Go to SQL Warehouses and select a warehouse
- Click “Connection Details”
- Copy the Server hostname and HTTP path
- Generate a Personal Access Token from User Settings → Access Tokens
Snowflake
SNOWFLAKE_ACCOUNT=your-account.snowflakecomputing.comSNOWFLAKE_USERNAME=your-usernameSNOWFLAKE_PASSWORD=your-passwordSNOWFLAKE_WAREHOUSE=COMPUTE_WHSNOWFLAKE_DATABASE=BENCHBOXSNOWFLAKE_SCHEMA=PUBLICHow to get Snowflake credentials:
- Your account identifier (e.g.,
xy12345.us-east-1) - Username and password for authentication
- Warehouse name (create one if needed:
CREATE WAREHOUSE COMPUTE_WH) - Database and schema for testing (will be created if missing)
BigQuery
BIGQUERY_PROJECT=your-project-idBIGQUERY_DATASET=benchbox_testBIGQUERY_LOCATION=USGOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.jsonHow to get BigQuery credentials:
- Create a Google Cloud project
- Enable the BigQuery API
- Create a service account with BigQuery Admin role
- Download the service account JSON key file
- Set
GOOGLE_APPLICATION_CREDENTIALSto the key file path
3. Verify Setup
Test that credentials are configured correctly. The first command checks what would run (dry run). The second runs a single platform test:
make test-live-databricks --dry-run
make test-live-databricksRunning Tests
Run All Live Tests
This runs all platforms and requires all credentials:
make test-live-allRun Individual Platforms
The commands below run Databricks only, Snowflake only, and BigQuery only:
make test-live-databricks
make test-live-snowflake
make test-live-bigqueryRun with pytest Directly
The commands below run all live tests, one platform’s tests, and one test file:
uv run -- python -m pytest -m live_integration -v
uv run -- python -m pytest -m live_databricks -v
uv run -- python -m pytest tests/integration/platforms/test_databricks_live.py -vTest Coverage
Databricks Tests (9 tests)
- Connection - Verify SQL Warehouse connectivity
- Version Info - Get platform metadata
- Catalog Access - Verify Unity Catalog permissions
- Schema Creation - Create isolated test schemas
- Data Loading - Load TPC-H SF=0.01 data
- Simple Query - Execute basic SELECT queries
- TPC-H Query - Run TPC-H Query 1 on loaded data
- COPY INTO - Test COPY INTO functionality
- Cleanup - Verify schema deletion works
Snowflake Tests (9 tests)
- Connection - Verify Snowflake connectivity
- Version Info - Get platform metadata
- Warehouse Access - Verify warehouse and database access
- Schema Creation - Create isolated test schemas
- Data Loading - Load TPC-H SF=0.01 data
- Simple Query - Execute basic SELECT queries
- TPC-H Query - Run TPC-H Query 1 on loaded data
- PUT + COPY - Test PUT + COPY INTO workflow
- Cleanup - Verify schema deletion works
BigQuery Tests (10 tests)
- Connection - Verify BigQuery connectivity
- Version Info - Get platform metadata
- Project Access - Verify project and dataset access
- Dataset Creation - Create isolated test datasets
- Data Loading - Load TPC-H SF=0.01 data
- Simple Query - Execute basic SELECT queries
- TPC-H Query - Run TPC-H Query 1 on loaded data
- GCS Load - Test GCS staging workflow
- Query Cost - Verify query cost estimation
- Cleanup - Verify dataset deletion works
Total: 28 live integration tests across 3 cloud platforms
Security Best Practices
Never Commit Credentials
.envfiles are in.gitignore- never commit them- Use
.env.exampleas a template with placeholder values - Rotate tokens/passwords regularly
Use Least Privilege
Create dedicated service accounts with minimal permissions:
Databricks:
- SQL Warehouse usage permission
- Schema create/drop permission
- No admin/cluster create permissions needed
Snowflake:
CREATE SCHEMAprivilegeUSAGEon warehouse and database- No
ACCOUNTADMINrole needed
BigQuery:
- BigQuery Data Editor role
- BigQuery Job User role
- Storage Object Admin (for GCS staging)
Isolate Test Resources
- Tests use unique schema names with timestamps
- Cleanup fixtures automatically remove test data
- No production data is touched
Troubleshooting
Tests are Skipped
Problem: All tests show SKIPPED
Solution: Check that required environment variables are set. The commands below check Databricks, Snowflake, and BigQuery in that order:
echo $DATABRICKS_TOKEN
echo $SNOWFLAKE_PASSWORD
echo $GOOGLE_APPLICATION_CREDENTIALSAuthentication Errors
Databricks: “Invalid access token”
- Verify token hasn’t expired
- Check workspace URL is correct
- Ensure SQL Warehouse is running
Snowflake: “Incorrect username or password”
- Verify credentials in Snowflake UI
- Check account identifier format
- Try connecting with
snowsqlCLI first
BigQuery: “Could not load credentials”
- Verify JSON key file path exists
- Check service account has required roles
- Try
gcloud auth application-default login
Data Loading Failures
Problem: Tests fail during data loading
Solutions:
- Verify sufficient warehouse/compute resources
- Check network connectivity
- Ensure sufficient storage quota
- Review platform-specific logs
Schema Cleanup Failures
Problem: Warning messages about failed schema deletion
Impact: Usually benign - schemas with timestamps avoid conflicts
Solution: Manually drop test schemas if needed. The statements below apply to Databricks, Snowflake, and BigQuery in that order, and are identical across the three:
DROP SCHEMA IF EXISTS benchbox_test_1234567890 CASCADE;
DROP SCHEMA IF EXISTS benchbox_test_1234567890 CASCADE;
DROP SCHEMA IF EXISTS benchbox_test_1234567890 CASCADE;CI/CD Integration (Optional)
GitHub Actions
Tests can run in CI with secrets. In this workflow, workflow_dispatch is a manual trigger and the cron schedule runs weekly on Sunday:
name: Live Integration Tests
on: workflow_dispatch: schedule: - cron: '0 0 * * 0'
jobs: test-databricks: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Install dependencies run: pip install ".[cloud]" - name: Run Databricks live tests env: DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} DATABRICKS_HTTP_PATH: ${{ secrets.DATABRICKS_HTTP_PATH }} DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} run: make test-live-databricksNote: Store credentials as GitHub Secrets, never in workflow files.
Cost Control in CI
- Run on manual trigger or schedule (not on every commit)
- Use smallest possible scale factors
- Set test timeouts to prevent runaway costs
- Monitor cloud spend regularly
Development Workflow
Adding New Tests
- Follow the existing test pattern in
test_databricks_live.py - Use fixtures from
conftest.py - Always include cleanup logic
- Record expected cost in the Cost Considerations section above
Testing Without Credentials
Regular smoke tests don’t require credentials and use stubs. Either command runs them:
make test-smokeuv run -- python -m pytest -m platform_smoke -vDebugging Live Tests
Enable verbose pytest output, and capture logs with the second command:
uv run -- python -m pytest -m live_databricks -vv -s
uv run -- python -m pytest -m live_databricks -v --log-cli-level=DEBUGAdditional Resources
- BenchBox Documentation
- Platform Setup Guide
- Databricks SQL Warehouse Docs
- Snowflake Connection Docs
- BigQuery Authentication Docs
Support
For issues or questions:
- GitHub Issues
- Review test output for specific error messages
- Check platform-specific documentation
Remember: Always protect your credentials and be mindful of cloud costs when running live integration tests.