test: fix username uniqueness#41
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates integration tests to avoid collisions caused by non-unique user (and some group) names, improving reliability when tests create many entities in shared CI environments.
Changes:
- Make test user display names unique by including the full generated ID (UUID-based) rather than a constant label or truncated ID.
- Update video and feed integration specs to use ID-suffixed names for users created inline.
- Adjust chat user-group integration tests (ListUserGroups assertion change; RemoveUserGroupMembers unskipped).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/integration/video_test_helpers.rb | Makes helper-created user names unique by including full user ID. |
| spec/integration/video_integration_spec.rb | Makes the “team user” name unique by including its generated ID. |
| spec/integration/feed_integration_spec.rb | Makes batch/partial-update user names unique by including user IDs. |
| spec/integration/chat_user_integration_spec.rb | Makes guest/admin/privacy/custom user names unique by including full IDs. |
| spec/integration/chat_user_group_integration_spec.rb | Changes ListUserGroups test expectations and unskips RemoveUserGroupMembers test. |
| spec/integration/chat_test_helpers.rb | Makes helper-created chat user names unique by including full user ID. |
Comments suppressed due to low confidence (1)
spec/integration/chat_user_group_integration_spec.rb:257
- This test was previously explicitly skipped due to backend support for POST /usergroups/{id}/members/delete. Now that it runs, it will hard-fail the whole CI integration job if the endpoint isn't available in the target environment. If rollout may be partial, consider rescuing GetStreamRuby::APIError for 404/Not Found (or similar) and calling skip with a clear message, similar to create_group's feature-availability handling.
it 'removes all members from a group and verifies it is empty' do
user_ids, _resp = create_test_users(2)
group_id = "test-group-#{SecureRandom.uuid}"
# Create group with members
create_group(id: group_id, name: "Remove Members Group #{group_id}", member_ids: user_ids)
# Verify members are present before removal
get_resp = @client.common.get_user_group(group_id)
expect(get_resp.user_group.members.length).to eq(user_ids.length)
# Remove all members explicitly by ID (backend requires member_ids)
@client.common.remove_user_group_members(
group_id,
GetStream::Generated::Models::RemoveUserGroupMembersRequest.new(
member_ids: user_ids,
),
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+142
to
151
| it 'lists groups and returns a non-empty result' do | ||
|
|
||
| group_id_a = "test-group-#{SecureRandom.uuid}" | ||
| group_id_b = "test-group-#{SecureRandom.uuid}" | ||
| create_group(id: group_id_a, name: "List Test Group One #{group_id_a}") | ||
| create_group(id: group_id_b, name: "List Test Group Two #{group_id_b}") | ||
| group_id = "test-group-#{SecureRandom.uuid}" | ||
| create_group(id: group_id, name: "List Test Group #{group_id}") | ||
|
|
||
| # Verify the endpoint returns results. We don't assert on specific | ||
| # group membership because the default page may not include our | ||
| # newly created group when the app has many existing groups. | ||
| # Specific group retrieval is covered by CreateAndGetUserGroup. | ||
| list_resp = @client.common.list_user_groups |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.