mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
test(metrics): match process assertions to collector platforms
Darwin does not register the Linux ProcessCollector, so the repository-counting test must not require its CPU and resident-memory samples. Keep those assertions inside the existing Linux block while retaining repository metrics coverage on every platform. This changes only platform-specific test expectations; production metrics and Linux coverage remain unchanged. Validation: inspected the collector registration guard and checked the diff. Darwin execution is still required on a Darwin worker. Assisted-by: Codex (GPT-6)
This commit is contained in:
+4
-2
@@ -1216,10 +1216,12 @@ mod tests {
|
||||
// render() recounts from disk)
|
||||
let output = metrics.render();
|
||||
assert!(output.contains("ngit_repositories_total 0"));
|
||||
assert!(output.contains("process_cpu_seconds_total"));
|
||||
assert!(output.contains("process_resident_memory_bytes"));
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
// ProcessCollector is registered only on Linux, just like the
|
||||
// cgroup collectors below. Repository metrics are portable.
|
||||
assert!(output.contains("process_cpu_seconds_total"));
|
||||
assert!(output.contains("process_resident_memory_bytes"));
|
||||
if let Some(directory) = cgroup_v2_directory() {
|
||||
if cgroup_cpu_seconds(&directory).is_some() {
|
||||
assert!(output.contains("ngit_cgroup_cpu_seconds_total"));
|
||||
|
||||
Reference in New Issue
Block a user