-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More ownership classes #2999
More ownership classes #2999
Conversation
✅ 21/21 passed, 4 skipped, 27m13s total Running from acceptance #6835 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; a few minor quibbles but more questions of preference than anything blocking.
assert ownership.owner_of(my_cluster_record) == ws.current_user.me().user_name | ||
assert ownership.owner_of(their_cluster_record) == another_user.user_name | ||
info_ownership = ClusterInfoOwnership(administrator_locator) | ||
assert info_ownership.owner_of(my_cluster_record) == ws.current_user.me().user_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ws.current_user.me()
is a REST call, so it's probably polite to factor that out as a local variable rather than call it twice.
admin_locator.get_workspace_administrator.return_value = "an_admin" | ||
|
||
ownership = ClusterDetailsOwnership(admin_locator) | ||
owner = ownership.owner_of(ClusterDetails(cluster_id="1")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the default for creator_name
is None
, but I think I prefer to explicitly provide it because it's an important detail for what we're testing.
admin_locator.get_workspace_administrator.return_value = "an_admin" | ||
|
||
ownership = JobOwnership(admin_locator) | ||
owner = ownership.owner_of(Job(job_id=1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here with creator_user_name=None
.
@@ -192,6 +192,16 @@ def _maybe_direct_owner(self, record: ClusterInfo) -> str | None: | |||
return record.creator | |||
|
|||
|
|||
class ClusterDetailsOwnership(Ownership[ClusterDetails]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is it coming from? we don't have a concept of cluster details
in our object model - we just have a cluster.
Changes
Existing Ownership classes deal with inventory objects.
We sometimes also need to get ownership from workspace objects.
This PR implements these for
Job
andClusterDetails
Linked issues
Progresses #1415
Functionality
None
Tests