-
Notifications
You must be signed in to change notification settings - Fork 205
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
[User management] Add CreateUserResponse and GetUserResponse gRPC response wrappers [DPP-854] #12682
[User management] Add CreateUserResponse and GetUserResponse gRPC response wrappers [DPP-854] #12682
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ponse wrappers [DPP-854] changelog_begin Ledger API Specification: CreateUser and GetUser endpoints of UserManagementService now return CreateUserResponse and GetUserResponse rather than User message. changelog_end Breaks-protobuf: true
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,11 @@ import com.daml.ledger.api.testtool.infrastructure.LedgerTestSuite | |
import com.daml.ledger.api.testtool.infrastructure.participant.ParticipantTestContext | ||
import com.daml.ledger.api.v1.admin.user_management_service.{ | ||
CreateUserRequest, | ||
CreateUserResponse, | ||
DeleteUserRequest, | ||
DeleteUserResponse, | ||
GetUserRequest, | ||
GetUserResponse, | ||
GrantUserRightsRequest, | ||
ListUserRightsRequest, | ||
ListUserRightsResponse, | ||
|
@@ -100,11 +102,11 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
|
||
} yield { | ||
assertTooManyUserRightsError(create1) | ||
assertEquals(create2, user1) | ||
assertEquals(create2.user, Some(user1)) | ||
assertTooManyUserRightsError(grant1) | ||
assertEquals(rights1.rights.size, permissionsMaxAndOne.tail.size) | ||
assertSameElements(rights1.rights, permissionsMaxAndOne.tail) | ||
assertEquals(create3, user2) | ||
assertEquals(create3.user, Some(user2)) | ||
} | ||
}) | ||
|
||
|
@@ -193,7 +195,7 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
get1 <- ledger.userManagement.getUser(GetUserRequest(AdminUserId)) | ||
rights1 <- ledger.userManagement.listUserRights(ListUserRightsRequest(AdminUserId)) | ||
} yield { | ||
assertEquals(get1, User(AdminUserId, "")) | ||
assertEquals(get1.user, Some(User(AdminUserId, ""))) | ||
assertEquals(rights1, ListUserRightsResponse(Seq(adminPermission))) | ||
} | ||
}) | ||
|
@@ -216,9 +218,9 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
res3 <- ledger.userManagement.createUser(CreateUserRequest(Some(user2), Nil)) | ||
res4 <- ledger.userManagement.deleteUser(DeleteUserRequest(userId2)) | ||
} yield { | ||
assertEquals(res1, user1) | ||
assertEquals(res1, CreateUserResponse(Some(user1))) | ||
assertUserAlreadyExists(res2) | ||
assertEquals(res3, user2) | ||
assertEquals(res3, CreateUserResponse(Some(user2))) | ||
Comment on lines
-219
to
+223
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could these changes require to add some exclusions to compatibility tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
assertEquals(res4, DeleteUserResponse()) | ||
} | ||
}) | ||
|
@@ -240,7 +242,7 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
.mustFail("retrieving non-existent user") | ||
} yield { | ||
assertUserNotFound(res2) | ||
assert(res1 == user1) | ||
assert(res1 == GetUserResponse(Some(user1))) | ||
} | ||
}) | ||
|
||
|
@@ -289,7 +291,7 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
def filterUsers(users: Iterable[User]) = users.filter(u => u.id == userId1 || u.id == userId2) | ||
|
||
assertSameElements(filterUsers(res1.users), Seq(user1)) | ||
assertEquals(res2, user2) | ||
assertEquals(res2.user, Some(user2)) | ||
assertSameElements( | ||
filterUsers(res3.users), | ||
Set(user1, user2), | ||
|
@@ -497,7 +499,7 @@ final class UserManagementServiceIT extends LedgerTestSuite { | |
res6 <- ledger.userManagement | ||
.listUserRights(ListUserRightsRequest(userId1)) | ||
} yield { | ||
assertEquals(res1, user1) | ||
assertEquals(res1.user, Some(user1)) | ||
assertEquals(res2, ListUserRightsResponse(Seq.empty)) | ||
assertSameElements( | ||
res3.newlyGrantedRights.toSet, | ||
|
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.
A wrapper type for the Protobuf should be added and that should be returned, rather than keeping the
User
type. Otherwise we lose the advantage of being able to evolve the API over time and this is especially important for the Java bindings, which are officially supported for external customers. I'm ok merging this as is and doing the work myself, just let me know what's your preference.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.
Would be great if you could handle it, thank you!
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.
Ok, I'll keep an eye on this and work on it once it's done.