From 413a59282dbd16c46c23a64d1f1222bdc4943490 Mon Sep 17 00:00:00 2001 From: Shachar Langbeheim Date: Thu, 1 Feb 2024 09:01:28 +0200 Subject: [PATCH] Use more informative test names (#883) The word "handle" usually hides what the test really checks, and should be made explicit. --- glide-core/tests/test_client.rs | 2 +- glide-core/tests/test_socket_listener.rs | 6 +++--- node/tests/RedisClientInternals.test.ts | 2 +- node/tests/SharedTests.ts | 14 ++++++++++---- python/python/tests/test_async_client.py | 8 +++++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/glide-core/tests/test_client.rs b/glide-core/tests/test_client.rs index 99bb7a955d..319d702e6a 100644 --- a/glide-core/tests/test_client.rs +++ b/glide-core/tests/test_client.rs @@ -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, ) { diff --git a/glide-core/tests/test_socket_listener.rs b/glide-core/tests/test_socket_listener.rs index 0f3befb275..83d23b9549 100644 --- a/glide-core/tests/test_socket_listener.rs +++ b/glide-core/tests/test_socket_listener.rs @@ -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, ) { @@ -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, @@ -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, diff --git a/node/tests/RedisClientInternals.test.ts b/node/tests/RedisClientInternals.test.ts index 3072667289..db541c1005 100644 --- a/node/tests/RedisClientInternals.test.ts +++ b/node/tests/RedisClientInternals.test.ts @@ -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) => { diff --git a/node/tests/SharedTests.ts b/node/tests/SharedTests.ts index 4dfc7cd7c0..abeee908ca 100644 --- a/node/tests/SharedTests.ts +++ b/node/tests/SharedTests.ts @@ -759,7 +759,10 @@ export function runBaseTests(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( [] ); @@ -903,7 +906,10 @@ export function runBaseTests(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); }); }, @@ -1392,7 +1398,7 @@ export function runCommonTests(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(); @@ -1459,7 +1465,7 @@ export function runCommonTests(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) => { diff --git a/python/python/tests/test_async_client.py b/python/python/tests/test_async_client.py index 1af9deb2b1..77737bfdc2 100644 --- a/python/python/tests/test_async_client.py +++ b/python/python/tests/test_async_client.py @@ -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) @@ -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 汉字" @@ -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()