Skip to content

Commit 905dad8

Browse files
committed
Add a new regex to filter
1 parent cbe82ca commit 905dad8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ private long getLongValueEntryFromFile(String file, String metric) {
122122
Path filePath = Paths.get(UNIFIED.getPath(), file);
123123
try {
124124
String strVal = Files.lines(filePath)
125-
.filter(l -> l.startsWith(metric))
126-
.filter(l -> l.split("\\s+")[0].equals(metric))
127-
.collect(Collectors.joining());
125+
.filter(l -> l.matches("^" + metric + "\\s+.*")).collect(Collectors.joining());
128126
if (strVal.isEmpty()) {
129127
// sometimes the match for the metric does not exist, e.g. cpu.stat's nr_periods iff the controller
130128
// is not enabled

0 commit comments

Comments
 (0)