From 869e9ca76b4fa2d1cb8c3ce336216b7b38747c60 Mon Sep 17 00:00:00 2001 From: kronwerk Date: Wed, 11 Dec 2024 17:46:46 +0300 Subject: [PATCH] tuned tests Signed-off-by: kronwerk --- tests/unit/aof-max-size.tcl | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tests/unit/aof-max-size.tcl b/tests/unit/aof-max-size.tcl index 4c35220a77..dd24573802 100644 --- a/tests/unit/aof-max-size.tcl +++ b/tests/unit/aof-max-size.tcl @@ -1,3 +1,14 @@ +proc setup r { + r set k v + r config set aof-max-size 1 + r set k2 v2 +} + +proc cleanup r { + r config set aof-max-size 0 + r flushall +} + start_server {tags {"aof-max-size" "external:skip"}} { r config set auto-aof-rewrite-percentage 0 ; # disable auto-rewrite r config set appendonly yes ; # enable AOF @@ -7,14 +18,13 @@ start_server {tags {"aof-max-size" "external:skip"}} { set master_port [srv 0 port] test "Low aof-max-size stops writing AOF with ENOSPC" { - r set k v - r config set aof-max-size 1 - - r set k2 v2 + setup r wait_for_log_messages 0 {"*Error writing to the AOF file: No space left on device*"} 0 100 10 + cleanup r } test "New write attempts fail and doesn't insrease AOF buffer anymore" { + setup r set info1 [r info] set buf1 [getInfoProperty $info1 mem_aof_buffer] set len1 [getInfoProperty $info1 aof_buffer_length] @@ -28,19 +38,25 @@ start_server {tags {"aof-max-size" "external:skip"}} { set len2 [getInfoProperty $info2 aof_buffer_length] assert_equal $buf1 $buf2 assert_equal $len1 $len2 + cleanup r } test "Increasing aof-max-size fixes AOF write error" { + setup r + set loglines [count_log_lines 0] ; # want to check new line, not from previous test r config set aof-max-size 1000 - wait_for_log_messages 0 {"*AOF write error looks solved. The server can write again.*"} 0 100 10 + wait_for_log_messages 0 {"*AOF write error looks solved. The server can write again.*"} $loglines 100 10 assert_equal [r set k3 v3] "OK" assert_equal [r get k3] "v3" + cleanup r } test "Meeting aof-max-size does not prevent AOF rewrite" { + setup r + r config set aof-max-size 100000 set loglines [count_log_lines 0] ; # want to check new line, not from previous test - + # start write load set load_handle0 [start_write_load $master_host $master_port 10] wait_for_condition 50 100 { @@ -57,5 +73,6 @@ start_server {tags {"aof-max-size" "external:skip"}} { # stop write load stop_write_load $load_handle0 wait_load_handlers_disconnected + cleanup r } } \ No newline at end of file