OpenIM RPC Service Test Control Script Documentation

This document serves as a comprehensive guide to understanding and utilizing the test.sh script for testing OpenIM RPC services. The test.sh script is a collection of bash functions designed to test various aspects of the OpenIM RPC services, ensuring that each part of the API is functioning as expected.

  • Scripts:https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/test.sh

For some complex, bulky functional tests, performance tests, and various e2e tests, We are all in the current warehouse to https://github.com/OpenIMSDK/Open-IM-Server/tree/main/test or https://github.com/openim-sigs/test-infra directory In the.

Usage

The test.sh script is located within the ./scripts/install/ directory of the OpenIM service's codebase. To use the script, navigate to this directory from your terminal:

cd ./scripts/install/
chmod +x test.sh

Running the Entire Test Suite

To execute all available tests, you can either call the script directly or use the make command:

./test.sh openim::test::test

Or, if you have a Makefile that defines the test-api target:

make test-api

Alternatively, you can invoke specific test functions by passing them as arguments:

./test.sh openim::test::<function_name>

This make command should be equivalent to running ./test.sh openim::test::test, provided that the Makefile is configured accordingly.

Executing Individual Test Functions

If you wish to run a specific set of tests, you can call the relevant function by passing it as an argument to the script. Here are some examples:

Message Tests:

./test.sh openim::test::msg

Authentication Tests:

./test.sh openim::test::auth

User Tests:

./test.sh openim::test::user

Friend Tests:

./test.sh openim::test::friend

Group Tests:

./test.sh openim::test::group

Each of these commands will run the test suite associated with the specific functionality of the OpenIM service.

Detailed Function Test Examples

Testing Message Sending and Receiving:

To test message functionality, the openim::test::msg function is called. It will register a user, send a message, and clear messages to ensure that the messaging service is operational.

./test.sh openim::test::msg

Testing User Registration and Account Checks:

The openim::test::user function will create new user accounts and perform a series of checks on these accounts to verify that user registration and account queries are functioning properly.

./test.sh openim::test::user

Testing Friend Management:

By invoking openim::test::friend, the script will test adding friends, checking friendship status, managing friend requests, and handling blacklisting.

./test.sh openim::test::friend

Testing Group Operations:

The openim::test::group function tests group creation, member addition, information retrieval, and member management within groups.

./test.sh openim::test::group

Log Output

Each test function will output logs to the terminal to confirm the success or failure of the tests. These logs are crucial for identifying issues and verifying that each part of the service is tested thoroughly.

Each function logs its success upon completion, which aids in debugging and understanding the test flow. The success message is standardized across functions:

openim::log::success "<Test suite name> completed successfully."

By following the guidelines and instructions outlined in this document, you can effectively utilize the test.sh script to test and verify the OpenIM RPC services' functionality.

Function feature

Function NameCorresponding API/ActionFunction Purpose
openim::test::msgMessaging OperationsTests all aspects of messaging, including sending, receiving, and managing messages.
openim::test::authAuthentication OperationsValidates the authentication process and session management, including token handling and forced logout.
openim::test::userUser Account OperationsCovers testing for user account creation, retrieval, updating, and overall management.
openim::test::friendFriend Relationship OperationsEnsures friend management functions correctly, including requests, listing, and blacklisting.
openim::test::groupGroup Management OperationsChecks group-related functionalities like creation, invitation, information retrieval, and member management.
openim::test::send_msgSend Message APISimulates sending a message from one user to another or within a group.
openim::test::revoke_msgRevoke Message API (TODO)(Planned) Will test the revocation of a previously sent message.
openim::test::user_registerUser Registration APIRegisters a new user in the system to validate the registration process.
openim::test::check_accountAccount Check APIChecks if an account exists for a given user ID.
openim::test::user_clear_all_msgClear All Messages APIClears all messages for a given user to validate message history management.
openim::test::get_tokenToken Retrieval APIRetrieves an authentication token to validate token management.
openim::test::force_logoutForce Logout APIForces a logout for a test user to validate session control.
openim::test::check_user_accountUser Account Existence Check APIConfirms the existence of a test user's account.
openim::test::get_usersGet Users APIRetrieves a list of users to validate user query functionality.
openim::test::get_users_infoGet User Information APIObtains detailed information for a given user.
openim::test::get_users_online_statusGet User Online Status APIChecks the online status of a user to validate presence functionality.
openim::test::update_user_infoUpdate User Information APIUpdates a user's information to validate account update capabilities.
openim::test::get_subscribe_users_statusGet Subscribed Users' Status APIRetrieves the status of users that a test user has subscribed to.
openim::test::subscribe_users_statusSubscribe to Users' Status APISubscribes a test user to a set of user statuses.
openim::test::set_global_msg_recv_optSet Global Message Receiving Option APISets the message receiving option for a test user.
openim::test::is_friendCheck Friendship Status APIVerifies if two users are friends within the system.
openim::test::add_friendSend Friend Request APISends a friend request from one user to another.
openim::test::get_friend_listGet Friend List APIRetrieves the friend list of a test user.
openim::test::get_friend_apply_listGet Friend Application List APIRetrieves friend applications for a test user.
openim::test::get_self_friend_apply_listGet Self-Friend Application List APIRetrieves the friend applications that the user has applied for.
openim::test::add_blackAdd User to Blacklist APIAdds a user to the test user's blacklist to validate blacklist functionality.
openim::test::remove_blackRemove User from Blacklist APIRemoves a user from the test user's blacklist.
openim::test::get_black_listGet Blacklist APIRetrieves the blacklist for a test user.
openim::test::create_groupGroup Creation APICreates a new group with test users to validate group creation.
openim::test::invite_user_to_groupInvite User to Group APIInvites a user to join a group to test invitation functionality.
openim::test::transfer_groupGroup Ownership Transfer APITests the transfer of group ownership from one member to another.
openim::test::get_groups_infoGet Group Information APIRetrieves information for specified groups to validate group query functionality.
openim::test::kick_groupKick User from Group APISimulates kicking a user from a group to test group membership management.
openim::test::get_group_members_infoGet Group Members Information APIObtains detailed information for members of a specified group.
openim::test::get_group_member_listGet Group Member List APIRetrieves a list of members for a given group to ensure member listing is functional.
openim::test::get_joined_group_listGet Joined Group List APIRetrieves a list of groups that a user has joined to validate user's group memberships.
openim::test::set_group_member_infoSet Group Member Information APIUpdates the information for a group member to test the update functionality.
openim::test::mute_groupMute Group APITests the ability to mute a group, disabling message notifications for its members.
openim::test::cancel_mute_groupCancel Mute Group APITests the ability to cancel the mute status of a group, re-enabling message notifications.
openim::test::dismiss_groupDismiss Group APITests the ability to dismiss and delete a group from the system.
openim::test::cancel_mute_group_memberCancel Mute Group Member APITests the ability to cancel mute status for a specific group member.
openim::test::join_groupJoin Group API (TODO)(Planned) Will test the functionality for a user to join a specified group.
openim::test::set_group_infoSet Group Information APITests the ability to update the group information, such as the name or description.
openim::test::quit_groupQuit Group APITests the functionality for a user to leave a specified group.
openim::test::get_recv_group_applicationListGet Received Group Application List APIRetrieves the list of group applications received by a user to validate application management.
openim::test::group_application_responseGroup Application Response API (TODO)(Planned) Will test the functionality to respond to a group join request.
openim::test::get_user_req_group_applicationListGet User Requested Group Application List APIRetrieves the list of group applications requested by a user to validate tracking of user's applications.
openim::test::mute_group_memberMute Group Member APITests the ability to mute a specific member within a group, disabling their ability to send messages.
openim::test::get_group_users_req_application_listGet Group Users Request Application List APIRetrieves a list of user requests for group applications to validate group request management.