swadhinbiswas

[email protected]
2026-07-29 13:43:30 +0600 committed NaN years ago
5e47b8c
commit 5e47b8c
1 file changed
+12 -0
Showing 1 changed file+12-0
▼crates/justapi-core/src/middleware.rs
+12-0
1929
1929
1930
1930
// --- Per-route rate limiter tests (Phase 55.1) ---
1931
1931
1932
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
1933
+ #[cfg(not(miri))]
1932
1934
#[tokio::test]
1933
1935
async fn per_route_rate_limit_allows_matching_prefix() {
1934
1936
let rl = PerRouteRateLimiter::new().add_rule(
1947
1949
assert_eq!(resp.status(), StatusCode::OK);
1948
1950
}
1949
1951
1952
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
1953
+ #[cfg(not(miri))]
1950
1954
#[tokio::test]
1951
1955
async fn per_route_rate_limit_rejects_when_exceeded() {
1952
1956
let rl = PerRouteRateLimiter::new().add_rule(
1971
1975
assert_eq!(resp.status(), StatusCode::TOO_MANY_REQUESTS);
1972
1976
}
1973
1977
1978
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
1979
+ #[cfg(not(miri))]
1974
1980
#[tokio::test]
1975
1981
async fn per_route_rate_limit_different_limits_per_prefix() {
1976
1982
let rl = PerRouteRateLimiter::new()
1997
2003
assert_eq!(resp.status(), StatusCode::TOO_MANY_REQUESTS);
1998
2004
}
1999
2005
2006
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
2007
+ #[cfg(not(miri))]
2000
2008
#[tokio::test]
2001
2009
async fn per_route_rate_limit_method_filter() {
2002
2010
let rl = PerRouteRateLimiter::new().add_rule(
2026
2034
assert_eq!(resp.status(), StatusCode::TOO_MANY_REQUESTS);
2027
2035
}
2028
2036
2037
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
2038
+ #[cfg(not(miri))]
2029
2039
#[tokio::test]
2030
2040
async fn per_route_rate_limit_no_fallback_allows_unmatched() {
2031
2041
let rl = PerRouteRateLimiter::new().add_rule(
2047
2057
}
2048
2058
}
2049
2059
2060
+ /// Skipped under Miri: governor uses raw_cpuid (inline assembly) not supported by Miri.
2061
+ #[cfg(not(miri))]
2050
2062
#[tokio::test]
2051
2063
async fn per_route_rate_limit_fallback_applies_to_unmatched() {
2052
2064
let rl = PerRouteRateLimiter::new()
2053
2065