Watch
0
0
Fork
You've already forked hyperhive
0

build the test certificate in code instead of committing one

This commit is contained in:
atlas 2026-10-25 18:41:52 +01:00 • committed by mara
commit 401a3c9a51

View file

@ -97,7 +97,7 @@ mod tests {
use opentelemetry_sdk::metrics::{InMemoryMetricExporter, PeriodicReader, SdkMeterProvider};
use std::path::PathBuf;
use crate::cert::tests::{CERT_PEM, NOT_AFTER, NOT_BEFORE};
use crate::cert::tests::{NOT_AFTER, NOT_BEFORE, certificate_pem};
/// A provider with both gauges registered for `path`, and the exporter it
/// flushes into.
@ -152,7 +152,7 @@ mod tests {
fn both_gauges_report_the_files_window_under_the_cert_label() {
let dir = scratch("window");
let path = dir.join("cert.pem");
std::fs::write(&path, CERT_PEM).expect("write");
std::fs::write(&path, certificate_pem(NOT_BEFORE, NOT_AFTER)).expect("write");
let (provider, exporter) = registered(&path);
assert_eq!(
collect(&provider, &exporter),
@ -192,7 +192,7 @@ mod tests {
let path = dir.join("cert.pem");
let (provider, exporter) = registered(&path);
assert_eq!(collect(&provider, &exporter), []);
std::fs::write(&path, CERT_PEM).expect("write");
std::fs::write(&path, certificate_pem(NOT_BEFORE, NOT_AFTER)).expect("write");
assert_eq!(collect(&provider, &exporter).len(), 2);
std::fs::remove_dir_all(&dir).expect("cleanup");
}