@@ -486,11 +486,12 @@ def _filter_record(r: LogRecord) -> bool:
486486 # find the log record of
487487 # Running command (command=['/app/gprofiler/resources/java/apsprof', '<PID>', 'load',
488488 # '/path/to/libasyncProfiler.so', 'true', 'start,...'])
489+ command = log_record_extra (r ).get ("command" , [])
489490 return (
490491 r .message == "Running command"
491- and len (log_record_extra ( r )[ " command" ] ) == 6
492- and log_record_extra ( r )[ " command" ][ 2 ] == "load"
493- and any (map (lambda k : k in log_record_extra ( r )[ " command" ][ 5 ], ["start," , "stop," ]))
492+ and len (command ) == 7
493+ and command [ 3 ] == "load"
494+ and any (map (lambda k : k in command [ 6 ], ["start," , "stop," ]))
494495 )
495496
496497 return list (filter (_filter_record , records ))
@@ -567,7 +568,7 @@ def test_java_noexec_or_ro_dirs(
567568 assert len (jattach_loads ) == 2
568569 # 3rd part of commandline to AP - shall begin with POSSIBLE_AP_DIRS[1]
569570 assert all (
570- log_record_extra (jl )["command" ][3 ].startswith (f"{ gprofiler .profilers .java .POSSIBLE_AP_DIRS [1 ]} /async-profiler-" )
571+ log_record_extra (jl )["command" ][4 ].startswith (f"{ gprofiler .profilers .java .POSSIBLE_AP_DIRS [1 ]} /async-profiler-" )
571572 for jl in jattach_loads
572573 )
573574
@@ -616,7 +617,7 @@ def test_java_symlinks_in_paths(
616617 # 2 entries - start and stop
617618 assert len (jattach_loads ) == 2
618619 # 3rd part of commandline to AP - shall begin with the final, resolved path.
619- assert all (log_record_extra (jl )["command" ][3 ].startswith ("/run/final_tmp/gprofiler_tmp/" ) for jl in jattach_loads )
620+ assert all (log_record_extra (jl )["command" ][4 ].startswith ("/run/final_tmp/gprofiler_tmp/" ) for jl in jattach_loads )
620621
621622
622623@pytest .mark .parametrize ("in_container" , [True ]) # only in container is enough
0 commit comments