Skip to content

Commit 0b48676

Browse files
committed
improve: globalize deny(unsafe_code)
1 parent 0b2f317 commit 0b48676

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

integration/cache_tests.rs

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -54,48 +54,47 @@ async fn test_certificate_cache_hit_rate() {
5454
let metrics_response =
5555
fixture.ctx.client.get(format!("{}/metrics", fixture.ctx.api_base_url)).send().await;
5656

57-
if let Ok(resp) = metrics_response {
58-
if resp.status().is_success() {
59-
if let Ok(metrics_text) = resp.text().await {
60-
println!("✓ Server metrics available");
61-
62-
// Look for cache-related metrics
63-
for line in metrics_text.lines() {
64-
if line.contains("infera_auth_cache") {
65-
println!(" {}", line);
66-
}
67-
}
68-
69-
// Parse cache hit/miss metrics if available
70-
let hits = metrics_text
71-
.lines()
72-
.find(|l| l.starts_with("infera_auth_cache_hits_total"))
73-
.and_then(|l| l.split_whitespace().nth(1))
74-
.and_then(|v| v.parse::<f64>().ok())
75-
.unwrap_or(0.0);
76-
77-
let misses = metrics_text
78-
.lines()
79-
.find(|l| l.starts_with("infera_auth_cache_misses_total"))
80-
.and_then(|l| l.split_whitespace().nth(1))
81-
.and_then(|v| v.parse::<f64>().ok())
82-
.unwrap_or(0.0);
83-
84-
if hits + misses > 0.0 {
85-
let hit_rate = hits / (hits + misses) * 100.0;
86-
println!(
87-
"✓ Cache hit rate: {:.1}% (hits: {}, misses: {})",
88-
hit_rate, hits as u64, misses as u64
89-
);
90-
91-
// Cache hit rate should be >90% for repeated requests
92-
if hit_rate < 90.0 {
93-
eprintln!(
94-
"Warning: Cache hit rate is low ({:.1}%) - expected >90%",
95-
hit_rate
96-
);
97-
}
98-
}
57+
if let Ok(resp) = metrics_response
58+
&& resp.status().is_success()
59+
&& let Ok(metrics_text) = resp.text().await
60+
{
61+
println!("✓ Server metrics available");
62+
63+
// Look for cache-related metrics
64+
for line in metrics_text.lines() {
65+
if line.contains("infera_auth_cache") {
66+
println!(" {}", line);
67+
}
68+
}
69+
70+
// Parse cache hit/miss metrics if available
71+
let hits = metrics_text
72+
.lines()
73+
.find(|l| l.starts_with("infera_auth_cache_hits_total"))
74+
.and_then(|l| l.split_whitespace().nth(1))
75+
.and_then(|v| v.parse::<f64>().ok())
76+
.unwrap_or(0.0);
77+
78+
let misses = metrics_text
79+
.lines()
80+
.find(|l| l.starts_with("infera_auth_cache_misses_total"))
81+
.and_then(|l| l.split_whitespace().nth(1))
82+
.and_then(|v| v.parse::<f64>().ok())
83+
.unwrap_or(0.0);
84+
85+
if hits + misses > 0.0 {
86+
let hit_rate = hits / (hits + misses) * 100.0;
87+
println!(
88+
"✓ Cache hit rate: {:.1}% (hits: {}, misses: {})",
89+
hit_rate, hits as u64, misses as u64
90+
);
91+
92+
// Cache hit rate should be >90% for repeated requests
93+
if hit_rate < 90.0 {
94+
eprintln!(
95+
"Warning: Cache hit rate is low ({:.1}%) - expected >90%",
96+
hit_rate
97+
);
9998
}
10099
}
101100
}

integration/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(unsafe_code)]
2+
13
// Integration tests for InferaDB engine-control authentication
24
//
35
// These tests validate end-to-end authentication flows between the engine

0 commit comments

Comments
 (0)