Skip to content

Commit 5cc0436

Browse files
authored
ci: Switch back to username password auth (#217)
1 parent 9114743 commit 5cc0436

File tree

9 files changed

+57
-47
lines changed

9 files changed

+57
-47
lines changed

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ jobs:
3232
id: setup
3333
uses: firebolt-db/integration-testing-setup@master
3434
with:
35-
firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }}
36-
firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }}
37-
api-endpoint: "api.staging.firebolt.io"
35+
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
36+
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
37+
api-endpoint: "api.dev.firebolt.io"
3838
region: "us-east-1"
3939

4040
- name: Run integration tests
4141
env:
42-
USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
43-
PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}
42+
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
43+
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
4444
SERVICE_ID: ${{ secrets.SERVICE_ID_STG }}
4545
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }}
4646
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
4747
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
4848
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
4949
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
5050
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
51-
API_ENDPOINT: "api.staging.firebolt.io"
51+
API_ENDPOINT: "api.dev.firebolt.io"
5252
ACCOUNT_NAME: "firebolt"
5353
run: |
5454
pytest -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration

.github/workflows/nightly.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ jobs:
4646
id: setup
4747
uses: firebolt-db/integration-testing-setup@master
4848
with:
49-
firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }}
50-
firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }}
51-
api-endpoint: "api.staging.firebolt.io"
49+
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
50+
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
51+
api-endpoint: "api.dev.firebolt.io"
5252
region: "us-east-1"
5353
db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }}
5454

5555
- name: Run integration tests
5656
env:
57-
USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
58-
PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}
57+
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
58+
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
5959
SERVICE_ID: ${{ secrets.SERVICE_ID_STG }}
6060
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }}
6161
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
@@ -64,7 +64,7 @@ jobs:
6464
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
6565
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
6666
ACCOUNT_NAME: "firebolt"
67-
API_ENDPOINT: "api.staging.firebolt.io"
67+
API_ENDPOINT: "api.dev.firebolt.io"
6868
run: |
6969
pytest --timeout_method "thread" -o log_cli=true -o log_cli_level=INFO tests/integration
7070

tests/integration/dbapi/async/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ async def username_password_connection(
2626
async def connection(
2727
engine_url: str,
2828
database_name: str,
29-
service_auth: Auth,
29+
password_auth: Auth,
3030
account_name: str,
3131
api_endpoint: str,
3232
) -> Connection:
3333
async with await connect(
3434
engine_url=engine_url,
3535
database=database_name,
36-
auth=service_auth,
36+
auth=password_auth,
3737
account_name=account_name,
3838
api_endpoint=api_endpoint,
3939
) as connection:
@@ -44,15 +44,15 @@ async def connection(
4444
async def connection_engine_name(
4545
engine_name: str,
4646
database_name: str,
47-
service_auth: Auth,
47+
password_auth: Auth,
4848
account_name: str,
4949
api_endpoint: str,
5050
) -> Connection:
5151

5252
async with await connect(
5353
engine_name=engine_name,
5454
database=database_name,
55-
auth=service_auth,
55+
auth=password_auth,
5656
account_name=account_name,
5757
api_endpoint=api_endpoint,
5858
) as connection:
@@ -62,14 +62,14 @@ async def connection_engine_name(
6262
@async_fixture
6363
async def connection_no_engine(
6464
database_name: str,
65-
service_auth: Auth,
65+
password_auth: Auth,
6666
account_name: str,
6767
api_endpoint: str,
6868
) -> Connection:
6969

7070
async with await connect(
7171
database=database_name,
72-
auth=service_auth,
72+
auth=password_auth,
7373
account_name=account_name,
7474
api_endpoint=api_endpoint,
7575
) as connection:

tests/integration/dbapi/async/test_auth_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ async def test_refresh_token(connection: Connection) -> None:
2828
assert c._client.auth.token != old, "Auth didn't update token on expiration."
2929

3030

31+
@mark.skip("Avoiding excessive load with username/password")
3132
async def test_credentials_invalidation(
3233
connection: Connection, username_password_connection: Connection
3334
) -> None:

tests/integration/dbapi/async/test_errors_async.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pytest import mark, raises
33

44
from firebolt.async_db import Connection, connect
5-
from firebolt.client.auth import ServiceAccount, UsernamePassword
5+
from firebolt.client.auth import UsernamePassword
66
from firebolt.utils.exception import (
77
AccountNotFoundError,
88
EngineNotRunningError,
@@ -38,15 +38,15 @@ async def test_invalid_account(
3838
async def test_engine_url_not_exists(
3939
engine_url: str,
4040
database_name: str,
41-
service_auth: ServiceAccount,
41+
password_auth: UsernamePassword,
4242
account_name: str,
4343
api_endpoint: str,
4444
) -> None:
4545
"""Connection properly reacts to invalid engine url error."""
4646
async with await connect(
4747
engine_url=engine_url + "_",
4848
database=database_name,
49-
auth=service_auth,
49+
auth=password_auth,
5050
account_name=account_name,
5151
api_endpoint=api_endpoint,
5252
) as connection:
@@ -57,7 +57,7 @@ async def test_engine_url_not_exists(
5757
async def test_engine_name_not_exists(
5858
engine_name: str,
5959
database_name: str,
60-
service_auth: ServiceAccount,
60+
password_auth: UsernamePassword,
6161
account_name: str,
6262
api_endpoint: str,
6363
) -> None:
@@ -66,7 +66,7 @@ async def test_engine_name_not_exists(
6666
async with await connect(
6767
engine_name=engine_name + "_________",
6868
database=database_name,
69-
auth=service_auth,
69+
auth=password_auth,
7070
account_name=account_name,
7171
api_endpoint=api_endpoint,
7272
) as connection:
@@ -76,7 +76,7 @@ async def test_engine_name_not_exists(
7676
async def test_engine_stopped(
7777
stopped_engine_url: str,
7878
database_name: str,
79-
service_auth: ServiceAccount,
79+
password_auth: UsernamePassword,
8080
account_name: str,
8181
api_endpoint: str,
8282
) -> None:
@@ -85,7 +85,7 @@ async def test_engine_stopped(
8585
async with await connect(
8686
engine_url=stopped_engine_url,
8787
database=database_name,
88-
auth=service_auth,
88+
auth=password_auth,
8989
account_name=account_name,
9090
api_endpoint=api_endpoint,
9191
) as connection:
@@ -94,14 +94,17 @@ async def test_engine_stopped(
9494

9595
@mark.skip(reason="Behaviour is different in prod vs dev")
9696
async def test_database_not_exists(
97-
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
97+
engine_url: str,
98+
database_name: str,
99+
password_auth: UsernamePassword,
100+
api_endpoint: str,
98101
) -> None:
99102
"""Connection properly reacts to invalid database error."""
100103
new_db_name = database_name + "_"
101104
async with await connect(
102105
engine_url=engine_url,
103106
database=new_db_name,
104-
auth=service_auth,
107+
auth=password_auth,
105108
api_endpoint=api_endpoint,
106109
) as connection:
107110
with raises(FireboltDatabaseError) as exc_info:

tests/integration/dbapi/sync/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ def username_password_connection(
2727
async def connection(
2828
engine_url: str,
2929
database_name: str,
30-
service_auth: Auth,
30+
password_auth: Auth,
3131
account_name: str,
3232
api_endpoint: str,
3333
) -> Connection:
3434
connection = connect(
3535
engine_url=engine_url,
3636
database=database_name,
37-
auth=service_auth,
37+
auth=password_auth,
3838
account_name=account_name,
3939
api_endpoint=api_endpoint,
4040
)
@@ -46,14 +46,14 @@ async def connection(
4646
def connection_engine_name(
4747
engine_name: str,
4848
database_name: str,
49-
service_auth: Auth,
49+
password_auth: Auth,
5050
account_name: str,
5151
api_endpoint: str,
5252
) -> Connection:
5353
connection = connect(
5454
engine_name=engine_name,
5555
database=database_name,
56-
auth=service_auth,
56+
auth=password_auth,
5757
account_name=account_name,
5858
api_endpoint=api_endpoint,
5959
)
@@ -64,13 +64,13 @@ def connection_engine_name(
6464
@fixture
6565
def connection_no_engine(
6666
database_name: str,
67-
service_auth: Auth,
67+
password_auth: Auth,
6868
account_name: str,
6969
api_endpoint: str,
7070
) -> Connection:
7171
connection = connect(
7272
database=database_name,
73-
auth=service_auth,
73+
auth=password_auth,
7474
account_name=account_name,
7575
api_endpoint=api_endpoint,
7676
)

tests/integration/dbapi/sync/test_auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def test_refresh_token(connection: Connection) -> None:
2828
assert c._client.auth.token != old, "Auth didn't update token on expiration"
2929

3030

31+
@mark.skip("Avoiding excessive load with username/password")
3132
@mark.parametrize("connection_fixture", ["connection", "username_password_connection"])
3233
def test_credentials_invalidation(connection_fixture: str, request) -> None:
3334
"""Auth raises Authentication Error on credentials invalidation"""

tests/integration/dbapi/sync/test_errors.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from httpx import ConnectError
22
from pytest import mark, raises
33

4-
from firebolt.client.auth import ServiceAccount, UsernamePassword
4+
from firebolt.client.auth import UsernamePassword
55
from firebolt.db import Connection, connect
66
from firebolt.utils.exception import (
77
AccountNotFoundError,
@@ -36,13 +36,16 @@ def test_invalid_account(
3636

3737

3838
def test_engine_url_not_exists(
39-
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
39+
engine_url: str,
40+
database_name: str,
41+
password_auth: UsernamePassword,
42+
api_endpoint: str,
4043
) -> None:
4144
"""Connection properly reacts to invalid engine url error."""
4245
with connect(
4346
engine_url=engine_url + "_",
4447
database=database_name,
45-
auth=service_auth,
48+
auth=password_auth,
4649
api_endpoint=api_endpoint,
4750
) as connection:
4851
with raises(ConnectError):
@@ -52,15 +55,15 @@ def test_engine_url_not_exists(
5255
def test_engine_name_not_exists(
5356
engine_name: str,
5457
database_name: str,
55-
service_auth: ServiceAccount,
58+
password_auth: UsernamePassword,
5659
api_endpoint: str,
5760
) -> None:
5861
"""Connection properly reacts to invalid engine name error."""
5962
with raises(FireboltEngineError):
6063
with connect(
6164
engine_name=engine_name + "_________",
6265
database=database_name,
63-
auth=service_auth,
66+
auth=password_auth,
6467
api_endpoint=api_endpoint,
6568
) as connection:
6669
connection.cursor().execute("show tables")
@@ -69,30 +72,33 @@ def test_engine_name_not_exists(
6972
def test_engine_stopped(
7073
stopped_engine_url: str,
7174
database_name: str,
72-
service_auth: ServiceAccount,
75+
password_auth: UsernamePassword,
7376
api_endpoint: str,
7477
) -> None:
7578
"""Connection properly reacts to engine not running error."""
7679
with raises(EngineNotRunningError):
7780
with connect(
7881
engine_url=stopped_engine_url,
7982
database=database_name,
80-
auth=service_auth,
83+
auth=password_auth,
8184
api_endpoint=api_endpoint,
8285
) as connection:
8386
connection.cursor().execute("show tables")
8487

8588

8689
@mark.skip(reason="Behaviour is different in prod vs dev")
8790
def test_database_not_exists(
88-
engine_url: str, database_name: str, service_auth: ServiceAccount, api_endpoint: str
91+
engine_url: str,
92+
database_name: str,
93+
password_auth: UsernamePassword,
94+
api_endpoint: str,
8995
) -> None:
9096
"""Connection properly reacts to invalid database error."""
9197
new_db_name = database_name + "_"
9298
with connect(
9399
engine_url=engine_url,
94100
database=new_db_name,
95-
auth=service_auth,
101+
auth=password_auth,
96102
api_endpoint=api_endpoint,
97103
) as connection:
98104
with raises(FireboltDatabaseError) as exc_info:

tests/integration/dbapi/sync/test_queries.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from firebolt.async_db._types import ColType, Column
99
from firebolt.async_db.cursor import QueryStatus
10-
from firebolt.client.auth import ServiceAccount
10+
from firebolt.client.auth import Auth
1111
from firebolt.db import (
1212
Connection,
1313
Cursor,
@@ -379,8 +379,7 @@ def test_set_invalid_parameter(connection: Connection):
379379
def test_anyio_backend_import_issue(
380380
engine_url: str,
381381
database_name: str,
382-
service_id: str,
383-
service_secret: str,
382+
password_auth: Auth,
384383
account_name: str,
385384
api_endpoint: str,
386385
_: int,
@@ -391,10 +390,10 @@ def test_anyio_backend_import_issue(
391390
exceptions = []
392391

393392
def run_query(idx: int):
394-
nonlocal service_id, service_secret, database_name, engine_url, account_name, api_endpoint
393+
nonlocal password_auth, database_name, engine_url, account_name, api_endpoint
395394
try:
396395
with connect(
397-
auth=ServiceAccount(service_id, service_secret),
396+
auth=password_auth,
398397
database=database_name,
399398
account_name=account_name,
400399
engine_url=engine_url,

0 commit comments

Comments
 (0)