Skip to content

Commit

Permalink
make redshift optional
Browse files Browse the repository at this point in the history
  • Loading branch information
petrkalos committed Oct 21, 2024
1 parent 13c615f commit d3da001
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests_new/integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class RedshiftConnection:
class TestData:
users: dict[str, User]
envs: dict[str, Env]
dashboards: dict[str, Dashboard]
redshift_connections: dict[str, RedshiftConnection]
dashboards: dict[str, Dashboard] = None
redshift_connections: dict[str, RedshiftConnection] = None


@pytest.fixture(scope='session', autouse=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,21 @@ def create_connection(client, env, group, name, conn_type, red_type, connection_
return connection


@pytest.fixture(scope='session')
def redshift_connections(testdata):
if testdata.redshift_connections:
return testdata.redshift_connections
pytest.skip('redshift config is missing')


"""
- Serverless namespace is deployed in session_env1 account
- Provisioned cluster is deployed in session_cross_acc_env_1
"""


@pytest.fixture(scope='session')
def session_connection_serverless_admin(client1, group1, session_env1, testdata):
def session_connection_serverless_admin(client1, group1, session_env1, redshift_connections):
connection = None
try:
connection = create_connection(
Expand All @@ -74,7 +81,7 @@ def session_connection_serverless_admin(client1, group1, session_env1, testdata)
env=session_env1,
group=group1,
red_type='serverless',
connection_data=testdata.redshift_connections['connection_serverless_admin_session_env1'],
connection_data=redshift_connections['connection_serverless_admin_session_env1'],
)

yield connection
Expand Down Expand Up @@ -102,7 +109,7 @@ def session_connection_serverless_admin_group_with_permissions(client1, group5,


@pytest.fixture(scope='session')
def session_connection_serverless_data_user(client1, group1, session_env1, testdata):
def session_connection_serverless_data_user(client1, group1, session_env1, redshift_connections):
connection = None
try:
connection = create_connection(
Expand All @@ -112,7 +119,7 @@ def session_connection_serverless_data_user(client1, group1, session_env1, testd
env=session_env1,
group=group1,
red_type='serverless',
connection_data=testdata.redshift_connections['connection_serverless_data_user_session_env1'],
connection_data=redshift_connections['connection_serverless_data_user_session_env1'],
)
yield connection
finally:
Expand All @@ -121,7 +128,7 @@ def session_connection_serverless_data_user(client1, group1, session_env1, testd


@pytest.fixture(scope='session')
def session_connection_cluster_admin(client5, group5, session_cross_acc_env_1, testdata):
def session_connection_cluster_admin(client5, group5, session_cross_acc_env_1, redshift_connections):
connection = None
try:
connection = create_connection(
Expand All @@ -131,7 +138,7 @@ def session_connection_cluster_admin(client5, group5, session_cross_acc_env_1, t
env=session_cross_acc_env_1,
group=group5,
red_type='cluster',
connection_data=testdata.redshift_connections['connection_cluster_admin_session_cross_acc_env_1'],
connection_data=redshift_connections['connection_cluster_admin_session_cross_acc_env_1'],
)
yield connection
finally:
Expand All @@ -140,7 +147,7 @@ def session_connection_cluster_admin(client5, group5, session_cross_acc_env_1, t


@pytest.fixture(scope='session')
def session_connection_cluster_data_user(client5, group5, session_cross_acc_env_1, testdata):
def session_connection_cluster_data_user(client5, group5, session_cross_acc_env_1, redshift_connections):
connection = None
try:
connection = create_connection(
Expand All @@ -150,7 +157,7 @@ def session_connection_cluster_data_user(client5, group5, session_cross_acc_env_
env=session_cross_acc_env_1,
group=group5,
red_type='cluster',
connection_data=testdata.redshift_connections['connection_cluster_data_user_session_cross_acc_env_1'],
connection_data=redshift_connections['connection_cluster_data_user_session_cross_acc_env_1'],
)
yield connection
finally:
Expand Down

0 comments on commit d3da001

Please sign in to comment.