Skip to content

Commit

Permalink
Use more informative test names
Browse files Browse the repository at this point in the history
The word "handle" usually hides what the test really checks, and should be made explicit.
  • Loading branch information
nihohit committed Jan 31, 2024
1 parent 07e6d43 commit c205a55
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion glide-core/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub(crate) mod shared_client_tests {

#[rstest]
#[timeout(SHORT_CLUSTER_TEST_TIMEOUT)]
fn test_client_handle_concurrent_workload(
fn test_client_handle_concurrent_workload_without_dropping_or_changing_values(
#[values(false, true)] use_tls: bool,
#[values(false, true)] use_cluster: bool,
) {
Expand Down
6 changes: 3 additions & 3 deletions glide-core/tests/test_socket_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ mod socket_listener {

#[rstest]
#[timeout(SHORT_CLUSTER_TEST_TIMEOUT)]
fn test_socket_handle_custom_command(
fn test_socket_pass_custom_command(
#[values(false, true)] args_pointer: bool,
#[values(true, false)] use_cluster: bool,
) {
Expand Down Expand Up @@ -669,7 +669,7 @@ mod socket_listener {

#[rstest]
#[timeout(SHORT_CLUSTER_TEST_TIMEOUT)]
fn test_socket_handle_long_input(
fn test_socket_send_and_receive_long_values(
#[values((false, false), (true, false), (false,true))] use_arg_pointer_and_tls: (
bool,
bool,
Expand Down Expand Up @@ -731,7 +731,7 @@ mod socket_listener {
// verifies that the outputs match the inputs.
#[rstest]
#[timeout(SHORT_CLUSTER_TEST_TIMEOUT)]
fn test_socket_handle_multiple_long_inputs(
fn test_socket_send_and_receive_multiple_long_inputs(
#[values((false, false), (true, false), (false,true))] use_arg_pointer_and_tls: (
bool,
bool,
Expand Down
2 changes: 1 addition & 1 deletion node/tests/RedisClientInternals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ describe("SocketConnectionInternals", () => {
});
});

it("should handle receiving a closing error with an unknown callback index", async () => {
it("should fail all requests when receiving a closing error with an unknown callback index", async () => {
await testWithResources(async (connection, socket) => {
const error = "check";
socket.once("data", (data) => {
Expand Down
14 changes: 10 additions & 4 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,10 @@ export function runBaseTests<Context>(config: {
"value3",
"value4",
]);
expect(await client.lpopCount(key, 2)).toEqual(["value2", "value3"]);
expect(await client.lpopCount(key, 2)).toEqual([
"value2",
"value3",
]);
expect(await client.lrange("nonExistingKey", 0, -1)).toEqual(
[]
);
Expand Down Expand Up @@ -903,7 +906,10 @@ export function runBaseTests<Context>(config: {
const valueList = ["value1", "value2", "value3", "value4"];
expect(await client.rpush(key, valueList)).toEqual(4);
expect(await client.rpop(key)).toEqual("value4");
expect(await client.rpopCount(key, 2)).toEqual(["value3", "value2"]);
expect(await client.rpopCount(key, 2)).toEqual([
"value3",
"value2",
]);
expect(await client.rpop("nonExistingKey")).toEqual(null);
});
},
Expand Down Expand Up @@ -1392,7 +1398,7 @@ export function runCommonTests<Context>(config: {
);

it(
"can handle non-ASCII unicode",
"can set and get non-ASCII unicode without modification",
async () => {
await runTest(async (client: Client) => {
const key = uuidv4();
Expand Down Expand Up @@ -1459,7 +1465,7 @@ export function runCommonTests<Context>(config: {
);

it(
"can handle concurrent operations",
"can handle concurrent operations without dropping or changing values",
async () => {
await runTest(async (client: Client) => {
const singleOp = async (index: number) => {
Expand Down
8 changes: 5 additions & 3 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def test_register_client_name_and_version(self, redis_client: TRedisClient
assert "lib-ver=0.1.0" in info

@pytest.mark.parametrize("cluster_mode", [True, False])
async def test_large_values(self, redis_client: TRedisClient):
async def test_send_and_receive_large_values(self, redis_client: TRedisClient):
length = 2**16
key = get_random_string(length)
value = get_random_string(length)
Expand All @@ -126,7 +126,7 @@ async def test_large_values(self, redis_client: TRedisClient):
assert await redis_client.get(key) == value

@pytest.mark.parametrize("cluster_mode", [True, False])
async def test_non_ascii_unicode(self, redis_client: TRedisClient):
async def test_send_and_receive_non_ascii_unicode(self, redis_client: TRedisClient):
key = "foo"
value = "שלום hello 汉字"
assert value == "שלום hello 汉字"
Expand All @@ -135,7 +135,9 @@ async def test_non_ascii_unicode(self, redis_client: TRedisClient):

@pytest.mark.parametrize("value_size", [100, 2**16])
@pytest.mark.parametrize("cluster_mode", [True, False])
async def test_concurrent_tasks(self, redis_client: TRedisClient, value_size):
async def test_client_handle_concurrent_workload_without_dropping_or_changing_values(
self, redis_client: TRedisClient, value_size
):
num_of_concurrent_tasks = 100
running_tasks = set()

Expand Down

0 comments on commit c205a55

Please sign in to comment.