Skip to content

Commit 2363006

Browse files
formatting
1 parent e840200 commit 2363006

4 files changed

Lines changed: 60 additions & 18 deletions

File tree

‎asap-planner-rs/src/lib.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ impl PlannerOutput {
137137
if qs == query {
138138
if let Some(YamlValue::Sequence(aggs)) = qm.get("aggregations") {
139139
if let Some(YamlValue::Mapping(agg)) = aggs.first() {
140-
for key in ["read_count_threshold", "num_aggregates_to_retain"] {
140+
for key in
141+
["read_count_threshold", "num_aggregates_to_retain"]
142+
{
141143
if let Some(v) = agg.get(key) {
142144
if let YamlValue::Number(n) = v {
143145
return n.as_u64();

‎asap-planner-rs/src/planner/logics.rs‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,16 @@ mod tests {
295295
// t_lookback = t_repeat = 300 (OnlySpatial path)
296296
// effective_repeat = 300 (step=0)
297297
// ceil((300 + 0) / 300) = 1
298-
let result =
299-
get_cleanup_param(CleanupPolicy::CircularBuffer, pt, &mr, 300, "tumbling", 0, 0)
300-
.unwrap();
298+
let result = get_cleanup_param(
299+
CleanupPolicy::CircularBuffer,
300+
pt,
301+
&mr,
302+
300,
303+
"tumbling",
304+
0,
305+
0,
306+
)
307+
.unwrap();
301308
assert_eq!(result, 1);
302309
}
303310

@@ -306,9 +313,16 @@ mod tests {
306313
let (pt, mr) = match_query("sum(some_metric)");
307314
// t_lookback = t_repeat = 300, effective_repeat = min(300, 30) = 30
308315
// ceil((300 + 3600) / 30) = ceil(130) = 130
309-
let result =
310-
get_cleanup_param(CleanupPolicy::CircularBuffer, pt, &mr, 300, "tumbling", 3600, 30)
311-
.unwrap();
316+
let result = get_cleanup_param(
317+
CleanupPolicy::CircularBuffer,
318+
pt,
319+
&mr,
320+
300,
321+
"tumbling",
322+
3600,
323+
30,
324+
)
325+
.unwrap();
312326
assert_eq!(result, 130);
313327
}
314328

@@ -355,8 +369,15 @@ mod tests {
355369
fn cleanup_param_mismatched_range_and_step_returns_error() {
356370
let (pt, mr) = match_query("sum(some_metric)");
357371
// range_duration > 0 but step == 0 is invalid
358-
let result =
359-
get_cleanup_param(CleanupPolicy::CircularBuffer, pt, &mr, 300, "tumbling", 3600, 0);
372+
let result = get_cleanup_param(
373+
CleanupPolicy::CircularBuffer,
374+
pt,
375+
&mr,
376+
300,
377+
"tumbling",
378+
3600,
379+
0,
380+
);
360381
assert!(result.is_err());
361382
}
362383
}

‎asap-planner-rs/src/planner/single_query.rs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,10 @@ mod tests {
447447

448448
#[test]
449449
fn identical_configs_have_same_key() {
450-
assert_eq!(base_config().identifying_key(), base_config().identifying_key());
450+
assert_eq!(
451+
base_config().identifying_key(),
452+
base_config().identifying_key()
453+
);
451454
}
452455

453456
#[test]
@@ -478,10 +481,14 @@ mod tests {
478481
fn parameter_insertion_order_does_not_affect_key() {
479482
let mut cfg1 = base_config();
480483
let mut cfg2 = base_config();
481-
cfg1.parameters.insert("depth".to_string(), Value::Number(3.into()));
482-
cfg1.parameters.insert("width".to_string(), Value::Number(1024.into()));
483-
cfg2.parameters.insert("width".to_string(), Value::Number(1024.into()));
484-
cfg2.parameters.insert("depth".to_string(), Value::Number(3.into()));
484+
cfg1.parameters
485+
.insert("depth".to_string(), Value::Number(3.into()));
486+
cfg1.parameters
487+
.insert("width".to_string(), Value::Number(1024.into()));
488+
cfg2.parameters
489+
.insert("width".to_string(), Value::Number(1024.into()));
490+
cfg2.parameters
491+
.insert("depth".to_string(), Value::Number(3.into()));
485492
assert_eq!(cfg1.identifying_key(), cfg2.identifying_key());
486493
}
487494
}

‎asap-planner-rs/tests/integration.rs‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ aggregate_cleanup:
217217
policy: "not_a_real_policy"
218218
"#;
219219
let c = Controller::from_yaml(yaml, arroyo_opts()).unwrap();
220-
assert!(matches!(c.generate(), Err(ControllerError::PlannerError(_))));
220+
assert!(matches!(
221+
c.generate(),
222+
Err(ControllerError::PlannerError(_))
223+
));
221224
}
222225

223226
#[test]
@@ -237,7 +240,10 @@ metrics:
237240
labels: ["instance"]
238241
"#;
239242
let c = Controller::from_yaml(yaml, arroyo_opts()).unwrap();
240-
assert!(matches!(c.generate(), Err(ControllerError::DuplicateQuery(_))));
243+
assert!(matches!(
244+
c.generate(),
245+
Err(ControllerError::DuplicateQuery(_))
246+
));
241247
}
242248

243249
#[test]
@@ -263,7 +269,10 @@ metrics:
263269
labels: ["instance"]
264270
"#;
265271
let c = Controller::from_yaml(yaml, arroyo_opts()).unwrap();
266-
assert!(matches!(c.generate(), Err(ControllerError::DuplicateQuery(_))));
272+
assert!(matches!(
273+
c.generate(),
274+
Err(ControllerError::DuplicateQuery(_))
275+
));
267276
}
268277

269278
#[test]
@@ -282,7 +291,10 @@ metrics:
282291
labels: ["instance"]
283292
"#;
284293
let c = Controller::from_yaml(yaml, arroyo_opts()).unwrap();
285-
assert!(matches!(c.generate(), Err(ControllerError::UnknownMetric(_))));
294+
assert!(matches!(
295+
c.generate(),
296+
Err(ControllerError::UnknownMetric(_))
297+
));
286298
}
287299

288300
#[test]

0 commit comments

Comments
 (0)