Skip to content

Commit

Permalink
both identities
Browse files Browse the repository at this point in the history
  • Loading branch information
alexradzin committed Dec 7, 2023
1 parent 5a6de0d commit 6a0bcfa
Show file tree
Hide file tree
Showing 20 changed files with 1,045 additions and 425 deletions.
183 changes: 165 additions & 18 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,43 @@ on:
required: false
type: string
secrets:
FIREBOLT_CLIENT_ID_STAGING_NEW_IDN:
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_STAGING_NEW_IDN:
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_ID_DEV_NEW_IDN:
FIREBOLT_CLIENT_ID_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_DEV_NEW_IDN:
FIREBOLT_CLIENT_SECRET_NEW_IDN:
required: true
FIREBOLT_USERNAME_STAGING:
required: true
FIREBOLT_PASSWORD_STAGING:
required: true
FIREBOLT_USERNAME_DEV:
required: true
FIREBOLT_PASSWORD_DEV:
required: true

workflow_dispatch:
inputs:
database1:
description: 'Database (v1) - a new one will be created if not provided'
required: false
default: ''
database2:
description: 'Database (v2) - a new one will be created if not provided'
required: false
default: ''
engine1:
description: 'Engine (v1) - a new one will be created if not provided'
required: false
engine2:
description: 'Engine (v2) - a new one will be created if not provided'
required: false
account:
description: 'Account'
required: true
default: 'developer'
environment:
description: 'Environment to run the tests against'
type: choice
Expand All @@ -28,8 +55,104 @@ on:
options:
- dev
- staging
run-v1:
description: 'Run tests against Firebolt DB v1'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
run-v2:
description: 'Run tests against Firebolt DB v2'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'


jobs:
tests:
tests1:
if: ${{ github.event.inputs.run-v1 == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ inputs.branch }}

- name: Set up .NET 6.0
id: dotnet-setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0

- name: use .NET 6.0
run: |
dotnet new globaljson --sdk-version '${{ steps.dotnet-setup.outputs.dotnet-version }}'
- name: Install dependencies
run: |
dotnet restore
- name: Determine env variables
run: |
if [ "${{ github.event.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
if: ${{ github.event.inputs.database1 == '' }}
id: setup1
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ env.USERNAME }}
firebolt-password: ${{ env.PASSWORD }}
api-endpoint: "api.${{ github.event.inputs.environment }}.firebolt.io"
region: "us-east-1"
instance-type: "B2"

- name: Determine database name
id: find-database-name
run: |
if ! [[ -z "${{ github.event.inputs.database1 }}" ]]; then
echo "database_name=${{ github.event.inputs.database1 }}" >> $GITHUB_OUTPUT
else
echo "database_name=${{ steps.setup1.outputs.database_name }}" >> $GITHUB_OUTPUT
fi
- name: Determine engine name
id: find-engine-name
run: |
if ! [[ -z "${{ github.event.inputs.engine1 }}" ]]; then
echo "engine_name=${{ github.event.inputs.engine1 }}" >> $GITHUB_OUTPUT
else
echo "engine_name=${{ steps.setup1.outputs.engine_name }}" >> $GITHUB_OUTPUT
fi
- name: Run integration tests
env:
FIREBOLT_ENV: ${{ inputs.environment }}
FIREBOLT_DATABASE: ${{ steps.setup1.outputs.database_name }}
FIREBOLT_ENGINE_NAME: ${{ steps.setup1.outputs.engine_name }}
FIREBOLT_ENDPOINT: "api.${{ github.event.inputs.environment }}.firebolt.io"
FIREBOLT_USERNAME: ${{ env.USERNAME }}
FIREBOLT_PASSWORD: ${{ env.PASSWORD }}
run: |
dotnet test --filter '(Category=Integration|Category=v1)&Category!=v2' -l "console;verbosity=normal"
tests2:
if: ${{ github.event.inputs.run-v2 == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand All @@ -38,9 +161,14 @@ jobs:
ref: ${{ inputs.branch }}

- name: Set up .NET 6.0
id: dotnet-setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0

- name: use .NET 6.0
run: |
dotnet new globaljson --sdk-version '${{ steps.dotnet-setup.outputs.dotnet-version }}'
- name: Install dependencies
run: |
Expand All @@ -49,33 +177,52 @@ jobs:
- name: Determine env variables
run: |
if [ "${{ inputs.environment }}" == 'staging' ]; then
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_STAGING_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_STAGING_NEW_IDN }}" >> "$GITHUB_ENV"
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"
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_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
if: ${{ github.event.inputs.database2 == '' }}
id: setup2
uses: firebolt-db/integration-testing-setup@v2
with:
firebolt-client-id: ${{ env.CLIENT_ID }}
firebolt-client-secret: ${{ env.CLIENT_SECRET }}
api-endpoint: "api.${{ inputs.environment }}.firebolt.io"
account: developer
account: ${{ github.event.inputs.account }}
api-endpoint: "api.${{ github.event.inputs.environment }}.firebolt.io"
instance-type: "B2"

- name: Determine database name
id: find-database-name
run: |
if ! [[ -z "${{ github.event.inputs.database2 }}" ]]; then
echo "database_name=${{ github.event.inputs.database2 }}" >> $GITHUB_OUTPUT
else
echo "database_name=${{ steps.setup2.outputs.database_name }}" >> $GITHUB_OUTPUT
fi
- name: Determine engine name
id: find-engine-name
run: |
if ! [[ -z "${{ github.event.inputs.engine2 }}" ]]; then
echo "engine_name=${{ github.event.inputs.engine2 }}" >> $GITHUB_OUTPUT
else
echo "engine_name=${{ steps.setup2.outputs.engine_name }}" >> $GITHUB_OUTPUT
fi
- name: Run integration tests
env:
FIREBOLT_DATABASE: ${{ steps.setup.outputs.database_name }}
FIREBOLT_ENV: ${{ inputs.environment }}
FIREBOLT_ACCOUNT: ${{ github.event.inputs.account }}
FIREBOLT_DATABASE: ${{ steps.setup2.outputs.database_name }}
FIREBOLT_ENGINE_NAME: ${{ steps.setup2.outputs.engine_name }}
FIREBOLT_CLIENT_ID: ${{ env.CLIENT_ID }}
FIREBOLT_CLIENT_SECRET: ${{ env.CLIENT_SECRET }}
FIREBOLT_ENDPOINT: "https://api.${{ inputs.environment }}.firebolt.io"
FIREBOLT_ENV: ${{ inputs.environment }}
FIREBOLT_ACCOUNT: "developer"
FIREBOLT_ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
run: |
dotnet test --filter "Category=Integration"
dotnet test --filter '(Category=Integration|Category=v2)&Category!=v1' -l "console;verbosity=normal"
Loading

0 comments on commit 6a0bcfa

Please sign in to comment.