Skip to content
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
12 changes: 6 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ jobs:
id: setup
uses: firebolt-db/integration-testing-setup@master
with:
firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }}
api-endpoint: "api.staging.firebolt.io"
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
api-endpoint: "api.dev.firebolt.io"
region: "us-east-1"

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID_STG }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
API_ENDPOINT: "api.staging.firebolt.io"
API_ENDPOINT: "api.dev.firebolt.io"
ACCOUNT_NAME: "firebolt"
run: |
pytest -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ jobs:
id: setup
uses: firebolt-db/integration-testing-setup@master
with:
firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }}
api-endpoint: "api.staging.firebolt.io"
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
api-endpoint: "api.dev.firebolt.io"
region: "us-east-1"
db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }}

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID_STG }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
Expand All @@ -64,7 +64,7 @@ jobs:
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
ACCOUNT_NAME: "firebolt"
API_ENDPOINT: "api.staging.firebolt.io"
API_ENDPOINT: "api.dev.firebolt.io"
run: |
pytest --timeout_method "thread" -o log_cli=true -o log_cli_level=INFO tests/integration

Expand Down
12 changes: 6 additions & 6 deletions tests/integration/dbapi/async/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ async def username_password_connection(
async def connection(
engine_url: str,
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:
async with await connect(
engine_url=engine_url,
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand All @@ -44,15 +44,15 @@ async def connection(
async def connection_engine_name(
engine_name: str,
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:

async with await connect(
engine_name=engine_name,
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand All @@ -62,14 +62,14 @@ async def connection_engine_name(
@async_fixture
async def connection_no_engine(
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:

async with await connect(
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/dbapi/async/test_auth_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async def test_refresh_token(connection: Connection) -> None:
assert c._client.auth.token != old, "Auth didn't update token on expiration."


@mark.skip("Avoiding excessive load with username/password")
async def test_credentials_invalidation(
connection: Connection, username_password_connection: Connection
) -> None:
Expand Down
21 changes: 12 additions & 9 deletions tests/integration/dbapi/async/test_errors_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pytest import mark, raises

from firebolt.async_db import Connection, connect
from firebolt.client.auth import ServiceAccount, UsernamePassword
from firebolt.client.auth import UsernamePassword
from firebolt.utils.exception import (
AccountNotFoundError,
EngineNotRunningError,
Expand Down Expand Up @@ -38,15 +38,15 @@ async def test_invalid_account(
async def test_engine_url_not_exists(
engine_url: str,
database_name: str,
service_auth: ServiceAccount,
password_auth: UsernamePassword,
account_name: str,
api_endpoint: str,
) -> None:
"""Connection properly reacts to invalid engine url error."""
async with await connect(
engine_url=engine_url + "_",
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand All @@ -57,7 +57,7 @@ async def test_engine_url_not_exists(
async def test_engine_name_not_exists(
engine_name: str,
database_name: str,
service_auth: ServiceAccount,
password_auth: UsernamePassword,
account_name: str,
api_endpoint: str,
) -> None:
Expand All @@ -66,7 +66,7 @@ async def test_engine_name_not_exists(
async with await connect(
engine_name=engine_name + "_________",
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand All @@ -76,7 +76,7 @@ async def test_engine_name_not_exists(
async def test_engine_stopped(
stopped_engine_url: str,
database_name: str,
service_auth: ServiceAccount,
password_auth: UsernamePassword,
account_name: str,
api_endpoint: str,
) -> None:
Expand All @@ -85,7 +85,7 @@ async def test_engine_stopped(
async with await connect(
engine_url=stopped_engine_url,
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
) as connection:
Expand All @@ -94,14 +94,17 @@ async def test_engine_stopped(

@mark.skip(reason="Behaviour is different in prod vs dev")
async def test_database_not_exists(
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
engine_url: str,
database_name: str,
password_auth: UsernamePassword,
api_endpoint: str,
) -> None:
"""Connection properly reacts to invalid database error."""
new_db_name = database_name + "_"
async with await connect(
engine_url=engine_url,
database=new_db_name,
auth=service_auth,
auth=password_auth,
api_endpoint=api_endpoint,
) as connection:
with raises(FireboltDatabaseError) as exc_info:
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/dbapi/sync/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def username_password_connection(
async def connection(
engine_url: str,
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:
connection = connect(
engine_url=engine_url,
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
)
Expand All @@ -46,14 +46,14 @@ async def connection(
def connection_engine_name(
engine_name: str,
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:
connection = connect(
engine_name=engine_name,
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
)
Expand All @@ -64,13 +64,13 @@ def connection_engine_name(
@fixture
def connection_no_engine(
database_name: str,
service_auth: Auth,
password_auth: Auth,
account_name: str,
api_endpoint: str,
) -> Connection:
connection = connect(
database=database_name,
auth=service_auth,
auth=password_auth,
account_name=account_name,
api_endpoint=api_endpoint,
)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/dbapi/sync/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_refresh_token(connection: Connection) -> None:
assert c._client.auth.token != old, "Auth didn't update token on expiration"


@mark.skip("Avoiding excessive load with username/password")
@mark.parametrize("connection_fixture", ["connection", "username_password_connection"])
def test_credentials_invalidation(connection_fixture: str, request) -> None:
"""Auth raises Authentication Error on credentials invalidation"""
Expand Down
24 changes: 15 additions & 9 deletions tests/integration/dbapi/sync/test_errors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from httpx import ConnectError
from pytest import mark, raises

from firebolt.client.auth import ServiceAccount, UsernamePassword
from firebolt.client.auth import UsernamePassword
from firebolt.db import Connection, connect
from firebolt.utils.exception import (
AccountNotFoundError,
Expand Down Expand Up @@ -36,13 +36,16 @@ def test_invalid_account(


def test_engine_url_not_exists(
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
engine_url: str,
database_name: str,
password_auth: UsernamePassword,
api_endpoint: str,
) -> None:
"""Connection properly reacts to invalid engine url error."""
with connect(
engine_url=engine_url + "_",
database=database_name,
auth=service_auth,
auth=password_auth,
api_endpoint=api_endpoint,
) as connection:
with raises(ConnectError):
Expand All @@ -52,15 +55,15 @@ def test_engine_url_not_exists(
def test_engine_name_not_exists(
engine_name: str,
database_name: str,
service_auth: ServiceAccount,
password_auth: UsernamePassword,
api_endpoint: str,
) -> None:
"""Connection properly reacts to invalid engine name error."""
with raises(FireboltEngineError):
with connect(
engine_name=engine_name + "_________",
database=database_name,
auth=service_auth,
auth=password_auth,
api_endpoint=api_endpoint,
) as connection:
connection.cursor().execute("show tables")
Expand All @@ -69,30 +72,33 @@ def test_engine_name_not_exists(
def test_engine_stopped(
stopped_engine_url: str,
database_name: str,
service_auth: ServiceAccount,
password_auth: UsernamePassword,
api_endpoint: str,
) -> None:
"""Connection properly reacts to engine not running error."""
with raises(EngineNotRunningError):
with connect(
engine_url=stopped_engine_url,
database=database_name,
auth=service_auth,
auth=password_auth,
api_endpoint=api_endpoint,
) as connection:
connection.cursor().execute("show tables")


@mark.skip(reason="Behaviour is different in prod vs dev")
def test_database_not_exists(
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
engine_url: str,
database_name: str,
password_auth: UsernamePassword,
api_endpoint: str,
) -> None:
"""Connection properly reacts to invalid database error."""
new_db_name = database_name + "_"
with connect(
engine_url=engine_url,
database=new_db_name,
auth=service_auth,
auth=password_auth,
api_endpoint=api_endpoint,
) as connection:
with raises(FireboltDatabaseError) as exc_info:
Expand Down
9 changes: 4 additions & 5 deletions tests/integration/dbapi/sync/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from firebolt.async_db._types import ColType, Column
from firebolt.async_db.cursor import QueryStatus
from firebolt.client.auth import ServiceAccount
from firebolt.client.auth import Auth
from firebolt.db import (
Connection,
Cursor,
Expand Down Expand Up @@ -379,8 +379,7 @@ def test_set_invalid_parameter(connection: Connection):
def test_anyio_backend_import_issue(
engine_url: str,
database_name: str,
service_id: str,
service_secret: str,
password_auth: Auth,
account_name: str,
api_endpoint: str,
_: int,
Expand All @@ -391,10 +390,10 @@ def test_anyio_backend_import_issue(
exceptions = []

def run_query(idx: int):
nonlocal service_id, service_secret, database_name, engine_url, account_name, api_endpoint
nonlocal password_auth, database_name, engine_url, account_name, api_endpoint
try:
with connect(
auth=ServiceAccount(service_id, service_secret),
auth=password_auth,
database=database_name,
account_name=account_name,
engine_url=engine_url,
Expand Down