Skip to content

test: fix username uniqueness#41

Merged
mogita merged 1 commit into
masterfrom
test/fix-user-groups
Mar 19, 2026
Merged

test: fix username uniqueness#41
mogita merged 1 commit into
masterfrom
test/fix-user-groups

Conversation

@mogita
Copy link
Copy Markdown
Collaborator

@mogita mogita commented Mar 19, 2026

  • fix username uniqueness
  • unskip RemoveUserGroupMembers

Copilot AI review requested due to automatic review settings March 19, 2026 13:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@mogita mogita merged commit 641b802 into master Mar 19, 2026
8 checks passed
@mogita mogita deleted the test/fix-user-groups branch March 19, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants