Fix flaky init_test proc in maxmemory test suite (#1419)

The following error has been seen, but not reliably reproduced:

```
*** [err]: eviction due to output buffers of pubsub, client eviction: true in tests/unit/maxmemory.tcl
Expected '42' to be equal to '50' (context: type proc line 17 cmd {assert_equal [r dbsize] 50} proc ::init_test level 2)
```

The reason is probably that FLUSHDB is asynchronous and when we start
populating new keys, they are evicted because the background flush is
too slow. Changing this to FLUSHDB SYNC prevents this.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
This commit is contained in:
Viktor Söderqvist 2024-12-10 19:52:06 +01:00 committed by GitHub
parent 7e564887b9
commit b4c2a1804a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ start_server {tags {"maxmemory" "external:skip"}} {
set server_pid [s process_id]
proc init_test {client_eviction} {
r flushdb
r flushdb sync
set prev_maxmemory_clients [r config get maxmemory-clients]
if $client_eviction {
@ -628,4 +628,4 @@ start_server {tags {"maxmemory" "external:skip"}} {
assert_equal [r dbsize] {0}
}
}
}