Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
RDruon committed Jul 12, 2023
1 parent 71e75df commit 9e583dc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/fixtures/valid/valid.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,3 @@ osd-ldiskfs.testfs-MDT0001.quota_slave.acct_user=
usr_accounting:
- id: 0
usage: { inodes: 265, kbytes: 356672 }
ldlm.namespaces.filter-ai400-OST0001_UUID.resource_count=0
6 changes: 3 additions & 3 deletions src/osd_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub(crate) fn params() -> Vec<String> {
format!("osd-*.*.{KBYTES_FREE}"),
format!("osd-*.*.{KBYTES_TOTAL}"),
format!("osd-*.*.{BRW_STATS}"),
format!("osd-*.{QUOTA_ACCT_GRP}"),
format!("osd-*.{QUOTA_ACCT_USR}"),
format!("osd-*.{QUOTA_ACCT_PRJ}"),
format!("osd-*.*.{QUOTA_ACCT_GRP}"),
format!("osd-*.*.{QUOTA_ACCT_USR}"),
format!("osd-*.*.{QUOTA_ACCT_PRJ}"),
]
}

Expand Down
7 changes: 4 additions & 3 deletions src/oss/job_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use combine::{
repeat::take_until,
},
stream::{Stream, StreamErrorFor},
Parser,
Parser, eof,
};

pub(crate) fn parse<I>() -> impl Parser<I, Output = Option<Vec<JobStatOst>>>
Expand All @@ -22,9 +22,10 @@ where
{
(
optional(newline()), // If Jobstats are present, the whole yaml blob will be on a newline
take_until(attempt((newline(), alpha_num()))),
take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))),
)
.skip(newline())
.skip(optional(newline()))
.skip(optional(eof()))
.and_then(|(_, x): (_, String)| {
serde_yaml::from_str(&x)
.map(|x: JobStatsOst| x.job_stats)
Expand Down
4 changes: 2 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub fn params() -> Vec<String> {
.chain(mgs_parser::params())
.chain(oss_parser::params())
.chain(mds_parser::params())
.chain(ldlm::params())
.chain(quota::params())
.chain(ldlm::params())
.collect()
}

Expand All @@ -39,8 +39,8 @@ where
mgs_parser::parse().map(|x| vec![x]),
mds_parser::parse().map(|x| vec![x]),
oss_parser::parse().map(|x| vec![x]),
ldlm::parse().map(|x| vec![x]),
quota::parse().map(|x| vec![x]),
ldlm::parse().map(|x| vec![x]),
)))
.map(|xs: Vec<_>| xs.into_iter().flatten().collect())
}
Expand Down
12 changes: 7 additions & 5 deletions src/quota/quota_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
QuotaKind, QuotaStat, QuotaStatOsd, QuotaStats, TargetQuotaStat,
};
use combine::{
attempt, choice,
attempt, choice, eof,
error::{ParseError, StreamError},
many, one_of, optional,
parser::{
Expand Down Expand Up @@ -51,9 +51,10 @@ where
optional(newline()), // If quota stats are present, the whole yaml blob will be on a newline
many::<Vec<_>, _, _>(alpha_num().or(one_of("_-:".chars()))), // But yaml header might not be properly formatted, ignore it
newline(),
take_until(attempt((newline(), alpha_num()))),
take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))),
)
.skip(newline())
.skip(optional(newline()))
.skip(optional(eof()))
.and_then(|(_, _, _, x): (_, _, _, String)| {
serde_yaml::from_str::<Vec<QuotaStat>>(&x).map_err(StreamErrorFor::<I>::other)
})
Expand All @@ -68,9 +69,10 @@ where
optional(newline()), // If quota stats are present, the whole yaml blob will be on a newline
many::<Vec<_>, _, _>(alpha_num().or(one_of("_-:".chars()))), // But yaml header might not be properly formatted, ignore it
newline(),
take_until(attempt((newline(), alpha_num()))),
take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))),
)
.skip(newline())
.skip(optional(newline()))
.skip(optional(eof()))
.and_then(|(_, _, _, x): (_, _, _, String)| {
serde_yaml::from_str::<Vec<QuotaStatOsd>>(&x).map_err(StreamErrorFor::<I>::other)
})
Expand Down
14 changes: 0 additions & 14 deletions src/snapshots/lustre_collector__parser__tests__node_output.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2374,20 +2374,6 @@ expression: result
},
),
),
Target(
ResourceCount(
TargetStat {
kind: Ost,
param: Param(
"resource_count",
),
target: Target(
"ai400-OST0001",
),
value: 0,
},
),
),
],
"",
)
6 changes: 6 additions & 0 deletions src/snapshots/lustre_collector__parser__tests__params.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ expression: params()
"osd-*.*.kbytesfree",
"osd-*.*.kbytestotal",
"osd-*.*.brw_stats",
"osd-*.*.quota_slave.acct_group",
"osd-*.*.quota_slave.acct_user",
"osd-*.*.quota_slave.acct_project",
"mdt.*.exports.*.uuid",
"mgs.*.mgs.stats",
"mgs.*.mgs.threads_max",
Expand All @@ -30,6 +33,9 @@ expression: params()
"mdt.*.job_stats",
"mdt.*.md_stats",
"mdt.*MDT*.num_exports",
"qmt.*.*.glb-usr",
"qmt.*.*.glb-prj",
"qmt.*.*.glb-grp",
"ldlm.namespaces.{mdt-,filter-}*.contended_locks",
"ldlm.namespaces.{mdt-,filter-}*.contention_seconds",
"ldlm.namespaces.{mdt-,filter-}*.ctime_age_limit",
Expand Down

0 comments on commit 9e583dc

Please sign in to comment.