forked from spotify/klio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request spotify#235 from spotify/lynn/fix-verify-roles
[cli] Log gcloud cmds to add required GCP roles to service accts
- Loading branch information
Showing
3 changed files
with
109 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,23 @@ def mock_create_sd_group(mocker): | |
{ | ||
"role": "roles/monitoring.metricWriter", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
} | ||
}, | ||
{ | ||
"role": "roles/pubsub.publisher", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/pubsub.subscriber", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectCreator", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectViewer", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
], | ||
False, | ||
), | ||
|
@@ -185,7 +201,7 @@ def test_verify_iam_roles( | |
result = job._verify_iam_roles() | ||
if create_resources: | ||
assert ( | ||
"--create-resources is not able to add these roles" | ||
"Klio is unable to add the required role(s)" | ||
in caplog.records[-1].msg | ||
) | ||
|
||
|
@@ -204,6 +220,22 @@ def test_verify_iam_roles_editor(caplog, klio_config, mock_discovery_client): | |
"role": "roles/monitoring.metricWriter", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/pubsub.publisher", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/pubsub.subscriber", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectCreator", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectViewer", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
}, | ||
{ | ||
"role": "roles/editor", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
|
@@ -248,6 +280,22 @@ def test_verify_iam_roles_with_svc_account(klio_config, mock_discovery_client): | |
"role": "roles/monitoring.metricWriter", | ||
"members": ["serviceAccount:[email protected]"], | ||
}, | ||
{ | ||
"role": "roles/pubsub.publisher", | ||
"members": ["serviceAccount:[email protected]"], | ||
}, | ||
{ | ||
"role": "roles/pubsub.subscriber", | ||
"members": ["serviceAccount:[email protected]"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectCreator", | ||
"members": ["serviceAccount:[email protected]"], | ||
}, | ||
{ | ||
"role": "roles/storage.objectViewer", | ||
"members": ["serviceAccount:[email protected]"], | ||
}, | ||
{ | ||
"role": "roles/editor", | ||
"members": ["serviceAccount:the-default-svc-account"], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters