File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
server/src/test/java/org/opensearch/monitor/os Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 3232
3333package org .opensearch .monitor .os ;
3434
35+ import static org .hamcrest .CoreMatchers .not ;
36+ import static org .hamcrest .CoreMatchers .nullValue ;
3537import static org .hamcrest .Matchers .allOf ;
3638import static org .hamcrest .Matchers .anyOf ;
3739import static org .hamcrest .Matchers .both ;
@@ -296,8 +298,12 @@ List<String> readSysFsCgroupCpuAcctCpuStat(String controlGroup) throws IOExcepti
296298 }
297299 };
298300
299- assumeThat ("CGroups are not available" , noCpuStatsOsProbe .areCgroupStatsAvailable (), is (true ));
300- noCpuStatsOsProbe .osStats ();
301+ assumeThat ("CGroups are available" , noCpuStatsOsProbe .areCgroupStatsAvailable (), is (true ));
302+ OsStats osStats = noCpuStatsOsProbe .osStats ();
303+
304+ // Depending on CGroups v1/v2, the cgroup stats may not be available
305+ assumeThat ("CGroup is available" , osStats .getCgroup (), is (not (nullValue ())));
306+
301307 // no nr_throttled and throttled_time
302308 verify (logger , times (2 )).warn (anyString ());
303309 reset (logger );
You can’t perform that action at this time.
0 commit comments