mirror of
https://github.com/goauthentik/authentik.git
synced 2026-08-30 18:51:39 -07:00
Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
committed by
GitHub
parent
8d8588c189
commit
312b0ff4fe
2
Makefile
2
Makefile
@@ -361,7 +361,7 @@ ci-lint-rustfmt: ci--meta-debug
|
||||
$(CARGO) +nightly fmt --all --check -- --config-path "${PWD}/.cargo/rustfmt.toml"
|
||||
|
||||
ci-lint-clippy: ci--meta-debug
|
||||
$(CARGO) clippy --workspace -- -D warnings
|
||||
$(CARGO) clippy --workspace --all-targets -- -D warnings
|
||||
|
||||
ci-lint-catalogs: ci--meta-debug
|
||||
node ./scripts/node/lint-catalogs.ts
|
||||
|
||||
@@ -408,7 +408,7 @@ mod tests {
|
||||
type Stream = I;
|
||||
|
||||
fn accept(&self, _stream: I, _service: S) -> Self::Future {
|
||||
Box::pin(async move { panic_any(42u32) })
|
||||
Box::pin(async move { panic_any(42_u32) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,6 +424,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(clippy::missing_trait_methods, reason = "We don't do vectored writing")]
|
||||
impl tokio::io::AsyncWrite for PanicStream {
|
||||
fn poll_write(
|
||||
self: std::pin::Pin<&mut Self>,
|
||||
@@ -531,7 +532,7 @@ mod tests {
|
||||
|
||||
let result = acceptor.accept(duplex_stream(), OkService).await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.expect("should not have panicked");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -543,8 +544,11 @@ mod tests {
|
||||
|
||||
let result = acceptor.accept(duplex_stream(), OkService).await;
|
||||
|
||||
assert!(result.is_err());
|
||||
assert_eq!(result.err().unwrap().to_string(), "inner error");
|
||||
let err = result
|
||||
.err()
|
||||
.expect("should have returned error")
|
||||
.to_string();
|
||||
assert_eq!(err, "inner error");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -595,13 +599,13 @@ mod tests {
|
||||
let tasks = Tasks::new().expect("failed to create tasks");
|
||||
let arbiter = tasks.arbiter();
|
||||
let (mut a, mut b) = duplex(1024);
|
||||
b.write_all(b"hello").await.unwrap();
|
||||
b.write_all(b"hello").await.expect("write");
|
||||
|
||||
let mut stream = CatchPanicStream::new(&mut a, arbiter.clone());
|
||||
let mut buf = [0u8; 5];
|
||||
let mut buf = [0_u8; 5];
|
||||
let result = stream.read(&mut buf).await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.expect("should not have panicked");
|
||||
assert_eq!(&buf, b"hello");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
@@ -612,11 +616,11 @@ mod tests {
|
||||
let arbiter = tasks.arbiter();
|
||||
let mut stream = CatchPanicStream::new(PanicStream, arbiter.clone());
|
||||
|
||||
let result = AssertUnwindSafe(stream.read(&mut [0u8; 10]))
|
||||
let result = AssertUnwindSafe(stream.read(&mut [0_u8; 10]))
|
||||
.catch_unwind()
|
||||
.await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -629,7 +633,7 @@ mod tests {
|
||||
let mut stream = CatchPanicStream::new(&mut a, arbiter.clone());
|
||||
let result = stream.write_all(b"hello").await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.expect("should not have panicked");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -643,7 +647,7 @@ mod tests {
|
||||
.catch_unwind()
|
||||
.await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -655,7 +659,7 @@ mod tests {
|
||||
|
||||
let result = AssertUnwindSafe(stream.flush()).catch_unwind().await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -667,7 +671,7 @@ mod tests {
|
||||
|
||||
let result = AssertUnwindSafe(stream.shutdown()).catch_unwind().await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -679,7 +683,7 @@ mod tests {
|
||||
|
||||
let result = poll_fn(|cx| service.poll_ready(cx)).await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.expect("should not have panicked");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -693,7 +697,7 @@ mod tests {
|
||||
.catch_unwind()
|
||||
.await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -705,7 +709,7 @@ mod tests {
|
||||
|
||||
let result = service.call(()).await;
|
||||
|
||||
assert!(result.is_ok());
|
||||
result.expect("should not have panicked");
|
||||
assert!(!fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -719,7 +723,7 @@ mod tests {
|
||||
.catch_unwind()
|
||||
.await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
|
||||
@@ -731,7 +735,7 @@ mod tests {
|
||||
|
||||
let result = AssertUnwindSafe(service.call(())).catch_unwind().await;
|
||||
|
||||
assert!(result.is_err());
|
||||
result.expect_err("should have panicked");
|
||||
assert!(fast_shutdown_triggered(&arbiter).await);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_scheme_case_insensitive() {
|
||||
async fn scheme_case_insensitive() {
|
||||
let (mut parts, _) = Request::builder()
|
||||
.uri("http://example.com/path")
|
||||
.header("x-forwarded-proto", "HTTPS")
|
||||
|
||||
@@ -87,7 +87,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn ipv4_mapped_ipv6_matches_ipv4_cidr() {
|
||||
config::init().unwrap();
|
||||
config::init().expect("config");
|
||||
// IPv4-mapped IPv6 address within the IPv4 CIDR matches.
|
||||
let ip: IpAddr = "::ffff:10.2.0.229".parse().expect("valid IP");
|
||||
assert!(ip_addr_trusted(&ip).is_some());
|
||||
|
||||
@@ -138,6 +138,7 @@ mod tests {
|
||||
/// Truncates the session table when dropped, cleaning up after the test.
|
||||
struct TruncateGuard;
|
||||
|
||||
#[expect(clippy::missing_trait_methods, reason = "We don't use pin_drop")]
|
||||
impl Drop for TruncateGuard {
|
||||
fn drop(&mut self) {
|
||||
tokio::task::block_in_place(|| {
|
||||
|
||||
Reference in New Issue
Block a user