Skip to content

Commit

Permalink
feat: Firebolt backwards compatibility (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiurin authored Dec 6, 2023
1 parent 1bc12cb commit 0dc7a5c
Show file tree
Hide file tree
Showing 14 changed files with 548 additions and 164 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20231204-143652.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Ability to connect to new and old Firebolt
time: 2023-12-04T14:36:52.025965Z
110 changes: 110 additions & 0 deletions .github/workflows/integration-tests-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Run integration tests V1

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the tests against'
type: choice
required: true
default: 'dev'
options:
- dev
- staging
workflow_call:
inputs:
environment:
default: 'staging'
required: false
type: string
secrets:
FIREBOLT_USERNAME_STAGING:
required: true
FIREBOLT_PASSWORD_STAGING:
required: true
FIREBOLT_USERNAME_DEV:
required: true
FIREBOLT_PASSWORD_DEV:
required: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]" --no-cache-dir
- name: Determine env variables
run: |
if [ "${{ inputs.environment }}" == 'staging' ]; then
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_STAGING }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_STAGING }}" >> "$GITHUB_ENV"
else
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_DEV }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_DEV }}" >> "$GITHUB_ENV"
fi
- name: Keep environment name in the summary
run: echo '### Ran integration tests against ${{ inputs.environment }} ' >> $GITHUB_STEP_SUMMARY

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ env.USERNAME }}
firebolt-password: ${{ env.PASSWORD }}
api-endpoint: "api.${{ inputs.environment }}.firebolt.io"
region: "us-east-1"

- name: Restore cached failed tests
id: cache-tests-restore
uses: actions/cache/restore@v3
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }}-v1

- name: Run integration tests
env:
USER_NAME: ${{ env.USERNAME }}
PASSWORD: ${{ env.PASSWORD }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io"
ACCOUNT_NAME: "firebolt"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/functional/ --alluredir=allure-results
- name: Save failed tests
id: cache-tests-save
uses: actions/cache/save@v3
if: failure()
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }}

- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Allure Report
uses: firebolt-db/action-allure-report@v1
if: always()
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
test-type: integration-v1
110 changes: 110 additions & 0 deletions .github/workflows/integration-tests-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Run integration tests V2

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the tests against'
type: choice
required: true
default: 'dev'
options:
- dev
- staging
workflow_call:
inputs:
environment:
default: 'staging'
required: false
type: string
secrets:
FIREBOLT_CLIENT_ID_DEV_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_DEV_NEW_IDN:
required: true
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN:
required: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]" --no-cache-dir
- name: Determine env variables
run: |
if [ "${{ inputs.environment }}" == 'staging' ]; then
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" >> "$GITHUB_ENV"
else
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_DEV_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_DEV_NEW_IDN }}" >> "$GITHUB_ENV"
fi
- name: Keep environment name in the summary
run: echo '### Ran integration tests against ${{ inputs.environment }} ' >> $GITHUB_STEP_SUMMARY

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v2
with:
firebolt-client-id: ${{ env.CLIENT_ID }}
firebolt-client-secret: ${{ env.CLIENT_SECRET }}
account: "automation"
api-endpoint: "api.${{ inputs.environment }}.firebolt.io"

- name: Restore cached failed tests
id: cache-tests-restore
uses: actions/cache/restore@v3
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }}-v2

- name: Run integration tests
env:
CLIENT_ID: ${{ env.CLIENT_ID }}
CLIENT_SECRET: ${{ env.CLIENT_SECRET }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io"
ACCOUNT_NAME: "automation"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/functional/ --alluredir=allure-results
- name: Save failed tests
id: cache-tests-save
uses: actions/cache/save@v3
if: failure()
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }}

- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Allure Report
uses: firebolt-db/action-allure-report@v1
if: always()
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
test-type: integration-v2
106 changes: 22 additions & 84 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,92 +19,30 @@ on:
type: string
secrets:
FIREBOLT_USERNAME_STAGING:
required: false
required: true
FIREBOLT_PASSWORD_STAGING:
required: false
required: true
FIREBOLT_USERNAME_DEV:
required: false
required: true
FIREBOLT_PASSWORD_DEV:
required: false
required: true
FIREBOLT_CLIENT_ID_DEV_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_DEV_NEW_IDN:
required: true
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN:
required: true

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]" --no-cache-dir
- name: Determine env variables
run: |
if [ "${{ inputs.environment }}" == 'staging' ]; then
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_STAGING }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_STAGING }}" >> "$GITHUB_ENV"
else
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_DEV }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_DEV }}" >> "$GITHUB_ENV"
fi
- name: Keep environment name in the summary
run: echo '### Ran integration tests against ${{ inputs.environment }} ' >> $GITHUB_STEP_SUMMARY

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ env.USERNAME }}
firebolt-password: ${{ env.PASSWORD }}
api-endpoint: "api.${{ inputs.environment }}.firebolt.io"
region: "us-east-1"

- name: Restore cached failed tests
id: cache-tests-restore
uses: actions/cache/restore@v3
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }}

- name: Run integration tests
env:
USER_NAME: ${{ env.USERNAME }}
PASSWORD: ${{ env.PASSWORD }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io"
ACCOUNT_NAME: "firebolt"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/functional/ --alluredir=allure-results
- name: Save failed tests
id: cache-tests-save
uses: actions/cache/save@v3
if: failure()
with:
path: |
.pytest_cache/v/cache/lastfailed
key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }}

- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Allure Report
uses: firebolt-db/action-allure-report@v1
if: always()
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
test-type: integration
integration-test-v1:
uses: ./.github/workflows/integration-tests-v1.yml
with:
environment: ${{ inputs.environment }}
secrets: inherit
integration-test-v2:
uses: ./.github/workflows/integration-tests-v2.yml
with:
environment: ${{ inputs.environment }}
secrets: inherit
Loading

0 comments on commit 0dc7a5c

Please sign in to comment.