44from time import sleep
55import threading
66import time
7- import psutil
8-
9-
10- def get_open_file_count (pid ):
11- """Get open file count using psutil library"""
12- try :
13- p = psutil .Process (pid )
14- return p .num_fds ()
15- except psutil .NoSuchProcess :
16- return 0
177
188@skip (cluster = True )
199def testBasicGC (env ):
@@ -434,20 +424,13 @@ def test_gc_oom(env:Env):
434424 for i in range (num_docs ):
435425 env .expect ('HSET' , f'doc{ i } ' , 't' , f'name{ i } ' ).equal (1 )
436426
437- # Get open file count
438- redis_server_pid = env .executeCommand ('info' )['process_id' ]
439- open_files_before_gc = get_open_file_count (redis_server_pid )
440- env .assertGreater (open_files_before_gc , 0 )
441-
442427 set_tight_maxmemory_for_oom (env )
443428
444429 # Delete them all
445430 for i in range (num_docs ):
446431 env .expect ('DEL' , f'doc{ i } ' ).equal (1 )
447- forceInvokeGC (env )
448- # Verify no open file descriptors were left behind
449- open_files_after_skip_gc = get_open_file_count (redis_server_pid )
450- env .assertEqual (open_files_before_gc , open_files_after_skip_gc )
432+
433+ forceInvokeGC (env )
451434
452435 # Verify no bytes collected by GC
453436 info = index_info (env )
@@ -465,5 +448,3 @@ def test_gc_oom(env:Env):
465448 bytes_collected = int (gc_dict ['bytes_collected' ])
466449 env .assertGreater (bytes_collected , 0 )
467450
468- open_files_after_gc = get_open_file_count (redis_server_pid )
469- env .assertEqual (open_files_before_gc , open_files_after_gc )
0 commit comments