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:
DanConwayDev
2026-09-19 15:34:36 +00:00
parent 5ef7480a01
commit d506b3f73a
+4 -2
View File
@@ -1216,10 +1216,12 @@ mod tests {
// render() recounts from disk) // render() recounts from disk)
let output = metrics.render(); let output = metrics.render();
assert!(output.contains("ngit_repositories_total 0")); 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")] #[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 let Some(directory) = cgroup_v2_directory() {
if cgroup_cpu_seconds(&directory).is_some() { if cgroup_cpu_seconds(&directory).is_some() {
assert!(output.contains("ngit_cgroup_cpu_seconds_total")); assert!(output.contains("ngit_cgroup_cpu_seconds_total"));