Skip to content

Commit

Permalink
after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Sofia Sazonova committed Dec 20, 2024
1 parent 822b3a2 commit d78e81a
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 130 deletions.
2 changes: 1 addition & 1 deletion backend/dataall/core/environment/cdk/environment_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def create_integration_tests_role(self):
],
effect=iam.Effect.ALLOW,
resources=[
f'arn:aws:iam::{self.account}:role/dataall-test-*',
f'arn:aws:iam::{self.account}:role/dataall-test*',
f'arn:aws:iam::{self.account}:role/dataall-session*',
],
),
Expand Down
222 changes: 115 additions & 107 deletions tests_new/integration_tests/modules/shares/s3_datasets_shares/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ def session_consumption_role_2(client6, group6, persistent_cross_acc_env_1, pers

@pytest.fixture(scope='session')
def session_share_1(
client5,
client1,
session_cross_acc_env_1,
session_s3_dataset1,
session_s3_dataset1_tables,
session_s3_dataset1_folders,
group5,
client5,
client1,
session_cross_acc_env_1,
session_s3_dataset1,
session_s3_dataset1_tables,
session_s3_dataset1_folders,
group5,
):
share1 = create_share_object(
client=client5,
Expand All @@ -122,13 +122,13 @@ def session_share_1(

@pytest.fixture(scope='session')
def session_share_2(
client5,
client1,
session_cross_acc_env_1,
session_imported_sse_s3_dataset1,
session_imported_sse_s3_dataset1_tables,
session_imported_sse_s3_dataset1_folders,
group5,
client5,
client1,
session_cross_acc_env_1,
session_imported_sse_s3_dataset1,
session_imported_sse_s3_dataset1_tables,
session_imported_sse_s3_dataset1_folders,
group5,
):
share2 = create_share_object(
client=client5,
Expand All @@ -149,16 +149,16 @@ def session_share_2(

@pytest.fixture(scope='session')
def session_share_3(
client6,
client1,
persistent_env1,
persistent_cross_acc_env_1,
updated_persistent_s3_dataset1,
group6,
client6,
client1,
persistent_env1,
persistent_cross_acc_env_1,
persistent_s3_dataset1,
group6,
):
share3 = create_share_object(
client=client6,
dataset_or_item_params={'datasetUri': updated_persistent_s3_dataset1.datasetUri},
dataset_or_item_params={'datasetUri': persistent_s3_dataset1.datasetUri},
environmentUri=persistent_cross_acc_env_1.environmentUri,
groupUri=group6,
principalId=group6,
Expand All @@ -174,14 +174,14 @@ def session_share_3(

@pytest.fixture(scope='session')
def session_share_consrole_1(
client5,
client1,
session_cross_acc_env_1,
session_s3_dataset1,
session_s3_dataset1_tables,
session_s3_dataset1_folders,
group5,
session_consumption_role_1,
client5,
client1,
session_cross_acc_env_1,
session_s3_dataset1,
session_s3_dataset1_tables,
session_s3_dataset1_folders,
group5,
session_consumption_role_1,
):
share1cr = create_share_object(
client=client5,
Expand All @@ -201,14 +201,14 @@ def session_share_consrole_1(

@pytest.fixture(scope='session')
def session_share_consrole_2(
client5,
client1,
session_cross_acc_env_1,
session_imported_sse_s3_dataset1,
session_imported_sse_s3_dataset1_tables,
session_imported_sse_s3_dataset1_folders,
group5,
session_consumption_role_1,
client5,
client1,
session_cross_acc_env_1,
session_imported_sse_s3_dataset1,
session_imported_sse_s3_dataset1_tables,
session_imported_sse_s3_dataset1_folders,
group5,
session_consumption_role_1,
):
share2cr = create_share_object(
client=client5,
Expand All @@ -229,17 +229,17 @@ def session_share_consrole_2(

@pytest.fixture(scope='session')
def session_share_consrole_3(
client6,
client1,
persistent_env1,
persistent_cross_acc_env_1,
updated_persistent_s3_dataset1,
group6,
session_consumption_role_2,
client6,
client1,
persistent_env1,
persistent_cross_acc_env_1,
persistent_s3_dataset1,
group6,
session_consumption_role_2,
):
share3cr = create_share_object(
client=client6,
dataset_or_item_params={'datasetUri': updated_persistent_s3_dataset1.datasetUri},
dataset_or_item_params={'datasetUri': persistent_s3_dataset1.datasetUri},
environmentUri=persistent_cross_acc_env_1.environmentUri,
groupUri=group6,
principalId=session_consumption_role_2.consumptionRoleUri,
Expand All @@ -263,17 +263,17 @@ def session_share_consrole_3(
]
)
def new_share_param(
request,
group5,
group6,
client5,
client6,
session_consumption_role_1,
session_consumption_role_2,
session_s3_dataset1,
updated_persistent_s3_dataset1,
session_cross_acc_env_1,
persistent_cross_acc_env_1,
request,
group5,
group6,
client5,
client6,
session_consumption_role_1,
session_consumption_role_2,
session_s3_dataset1,
persistent_s3_dataset1,
session_cross_acc_env_1,
persistent_cross_acc_env_1,
): # return: client, group, dataset, env, principal_id, principal_type
share_type, principal_type = request.param
if principal_type == 'Group':
Expand All @@ -283,7 +283,7 @@ def new_share_param(
yield (
client6,
group6,
updated_persistent_s3_dataset1,
persistent_s3_dataset1,
persistent_cross_acc_env_1,
group6,
principal_type,
Expand All @@ -302,7 +302,7 @@ def new_share_param(
yield (
client6,
group6,
updated_persistent_s3_dataset1,
persistent_s3_dataset1,
persistent_cross_acc_env_1,
session_consumption_role_2.consumptionRoleUri,
principal_type,
Expand All @@ -318,23 +318,25 @@ def new_share_param(
]
)
def share_params_main(
request,
group5,
group6,
client5,
client6,
session_share_1,
session_share_consrole_1,
session_share_3,
session_share_consrole_3,
session_s3_dataset1,
updated_persistent_s3_dataset1,
session_cross_acc_env_1_aws_client,
persistent_cross_acc_env_1_aws_client,
persistent_cross_acc_env_1,
session_cross_acc_env_1,
session_consumption_role_2,
session_consumption_role_1,
request,
group5,
group6,
client5,
client6,
session_share_1,
session_share_consrole_1,
session_share_3,
session_share_consrole_3,
session_s3_dataset1,
persistent_s3_dataset1,
session_cross_acc_env_1_aws_client,
persistent_cross_acc_env_1_aws_client,
persistent_cross_acc_env_1,
session_cross_acc_env_1_integration_role_arn,
persistent_cross_acc_env_1_integration_role_arn,
session_cross_acc_env_1,
session_consumption_role_2,
session_consumption_role_1,
): # return: client, group, env_client, role, share, dataset
share_type, principal_type = request.param
if principal_type == 'Group':
Expand All @@ -347,6 +349,7 @@ def share_params_main(
session_consumption_role_1,
session_share_1,
session_s3_dataset1,
session_cross_acc_env_1_integration_role_arn,
)
if share_type == 'session_persistent_dataset':
yield (
Expand All @@ -356,27 +359,32 @@ def share_params_main(
persistent_cross_acc_env_1_aws_client,
session_consumption_role_2,
session_share_3,
updated_persistent_s3_dataset1,
persistent_s3_dataset1,
persistent_cross_acc_env_1_integration_role_arn,
)

else:
if share_type == 'session_dataset':
yield (
client5,
group5,
session_cross_acc_env_1,
session_cross_acc_env_1_aws_client,
session_consumption_role_1,
session_share_consrole_1,
session_s3_dataset1,
session_cross_acc_env_1_integration_role_arn,
)
if share_type == 'session_persistent_dataset':
yield (
client6,
group6,
persistent_cross_acc_env_1,
persistent_cross_acc_env_1_aws_client,
session_consumption_role_2,
session_share_consrole_3,
updated_persistent_s3_dataset1,
persistent_s3_dataset1,
persistent_cross_acc_env_1_integration_role_arn,
)


Expand All @@ -391,18 +399,18 @@ def share_params_main(
]
)
def share_params_all(
request,
client5,
client6,
session_share_1,
session_share_consrole_1,
session_share_3,
session_share_consrole_3,
session_s3_dataset1,
session_share_2,
session_share_consrole_2,
session_imported_sse_s3_dataset1,
updated_persistent_s3_dataset1,
request,
client5,
client6,
session_share_1,
session_share_consrole_1,
session_share_3,
session_share_consrole_3,
session_s3_dataset1,
session_share_2,
session_share_consrole_2,
session_imported_sse_s3_dataset1,
persistent_s3_dataset1,
): # return client, share, dataset
autoapproval, principal_type, share_type = request.param
if autoapproval:
Expand All @@ -415,12 +423,12 @@ def share_params_all(
if share_type == 'session_dataset':
yield client5, session_share_1, session_s3_dataset1
if share_type == 'session_persistent_dataset':
yield client6, session_share_3, updated_persistent_s3_dataset1
yield client6, session_share_3, persistent_s3_dataset1
else:
if share_type == 'session_dataset':
yield client5, session_share_consrole_1, session_s3_dataset1
if share_type == 'session_persistent_dataset':
yield client6, session_share_consrole_3, updated_persistent_s3_dataset1
yield client6, session_share_consrole_3, persistent_s3_dataset1


# --------------PERSISTENT FIXTURES----------------------------
Expand Down Expand Up @@ -450,16 +458,16 @@ def persistent_consumption_role_1(client5, group5, persistent_cross_acc_env_1, p

@pytest.fixture(scope='session')
def persistent_group_share_1(
client5,
client1,
persistent_env1,
persistent_cross_acc_env_1,
updated_persistent_s3_dataset1,
group5,
client5,
client1,
persistent_env1,
persistent_cross_acc_env_1,
persistent_s3_dataset1,
group5,
):
share1 = create_share_object(
client=client5,
dataset_or_item_params={'datasetUri': updated_persistent_s3_dataset1.datasetUri},
dataset_or_item_params={'datasetUri': persistent_s3_dataset1.datasetUri},
environmentUri=persistent_cross_acc_env_1.environmentUri,
groupUri=group5,
principalId=group5,
Expand All @@ -482,17 +490,17 @@ def persistent_group_share_1(

@pytest.fixture(scope='session')
def persistent_role_share_1(
client5,
client1,
persistent_env1,
persistent_cross_acc_env_1,
updated_persistent_s3_dataset1,
group5,
persistent_consumption_role_1,
client5,
client1,
persistent_env1,
persistent_cross_acc_env_1,
persistent_s3_dataset1,
group5,
persistent_consumption_role_1,
):
share1 = create_share_object(
client=client5,
dataset_or_item_params={'datasetUri': updated_persistent_s3_dataset1.datasetUri},
dataset_or_item_params={'datasetUri': persistent_s3_dataset1.datasetUri},
environmentUri=persistent_cross_acc_env_1.environmentUri,
groupUri=group5,
principalId=persistent_consumption_role_1.consumptionRoleUri,
Expand All @@ -515,7 +523,7 @@ def persistent_role_share_1(

@pytest.fixture(params=['Group', 'ConsumptionRole'])
def persistent_share_params_main(
request, persistent_cross_acc_env_1, persistent_role_share_1, persistent_group_share_1
request, persistent_cross_acc_env_1, persistent_role_share_1, persistent_group_share_1
):
if request.param == 'Group':
yield persistent_group_share_1, persistent_cross_acc_env_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def check_share_items_access(
f'arn:aws:s3:{dataset.region}:{dataset.AwsAccountId}:accesspoint/{consumption_data.s3AccessPointName}'
)
if principal_type == 'Group':
workgroup = athena_client.get_env_work_group(share_environment.label)
workgroup = athena_client.get_work_group(share_environment.label, group)
athena_workgroup_output_location = None
else:
workgroup = 'primary'
Expand Down
Loading

0 comments on commit d78e81a

Please sign in to comment.