-
Notifications
You must be signed in to change notification settings - Fork 4
ci: fix the CI jobs that fail on every master run #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
393302f
a7a3cdb
c48dd23
ac9068b
85f80a8
b6dd5c3
f577c9f
e5d1daf
ddb9348
cc1519f
7d0eb24
13e8605
80d9bee
7dae988
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| [build] | ||
| rustc-wrapper = "/home/vheins/.cargo/bin/sccache" | ||
|
|
||
| # sccache is opt-in: export `RUSTC_WRAPPER=sccache` (or set | ||
| # `build.rustc-wrapper` in your own `~/.cargo/config.toml`) to route rustc | ||
| # through it. A machine-specific wrapper path here would break every other | ||
| # checkout; CI sets `RUSTC_WRAPPER` only in the jobs that install sccache. | ||
| [env] | ||
| SCCACHE_CACHE_SIZE = "5G" | ||
| CARGO_INCREMENTAL = "0" | ||
|
|
||
| # Convenience alias so the documented `cargo xtask <task>` surface works without | ||
| # a separate `cargo-xtask` binary (ADOPT-030). Expands to `cargo run -p xtask --`. | ||
| [alias] | ||
| xtask = "run -p xtask --" | ||
| xtask = "run -p xtask --" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,11 +10,13 @@ | |
| //! [`MemoryUserProvider`]: rustasea::auth::MemoryUserProvider | ||
| //! [`PROVIDER_LOCK`]: super::settings_flows::PROVIDER_LOCK | ||
|
|
||
| use std::net::SocketAddr; | ||
| use std::sync::atomic::{AtomicU8, Ordering}; | ||
| use std::sync::Arc; | ||
| use std::time::{SystemTime, UNIX_EPOCH}; | ||
|
|
||
| use axum::body::Body; | ||
| use axum::extract::Extension; | ||
| use axum::extract::{ConnectInfo, Extension}; | ||
| use axum::http::{header, HeaderMap, HeaderValue, Request, StatusCode}; | ||
| use axum::Router; | ||
| use rustasea::auth::users::{AuthUserRecord, MemoryUserRegistry}; | ||
|
|
@@ -227,11 +229,27 @@ async fn confirm(secret: &str) { | |
| assert_eq!(status, StatusCode::OK, "confirm: {body}"); | ||
| } | ||
|
|
||
| /// Last octet of the peer address handed to the next login (see [`unique_peer`]). | ||
| static NEXT_PEER_OCTET: AtomicU8 = AtomicU8::new(1); | ||
|
|
||
| /// A distinct loopback peer for one login request. | ||
| /// | ||
| /// The `login` limiter allows five attempts per minute per `username|ip`, and | ||
| /// its registry is process-wide. Without `ConnectInfo` every test login | ||
| /// resolves to the same `0.0.0.0` peer, so the lifecycle test's five logins as | ||
| /// `ada@example.com`, on top of other modules' logins as the same user, hit | ||
| /// `429`. A fresh peer per login keeps each request in its own bucket. | ||
| fn unique_peer() -> ConnectInfo<SocketAddr> { | ||
| let octet = NEXT_PEER_OCTET.fetch_add(1, Ordering::Relaxed); | ||
| ConnectInfo(SocketAddr::from(([127, 0, 2, octet], 54321))) | ||
| } | ||
|
|
||
| /// Start a challenge by logging in; returns the pending session id. | ||
| async fn start_challenge(guard: &Arc<SessionGuard>) -> String { | ||
| let body = format!("email={USER_A_EMAIL}&password={USER_A_PASSWORD}"); | ||
| let (status, headers, response) = | ||
| call(app_with_guard(guard.clone()), post("/login", &body)).await; | ||
| let mut request = post("/login", &body); | ||
| request.extensions_mut().insert(unique_peer()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Login throttle collapses to one global bucket in production Problem Evidence
Suggestion
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed: the test change was hiding a live production bug. Fixed in 7d0eb24 (
The two-factor test keeps attaching a peer, since every production request now carries one. The remaining |
||
| let (status, headers, response) = call(app_with_guard(guard.clone()), request).await; | ||
| assert_eq!(status, StatusCode::FOUND, "login: {response}"); | ||
| assert_eq!(location(&headers).as_deref(), Some("/two-factor-challenge")); | ||
| cookie_value(&headers, SESSION_COOKIE_NAME).expect("pending session cookie") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LOW] CI job table still documents the old test command
Problem
This line documents the new opt-in sccache behaviour, but the job table a few lines above still lists the
testjob ascargo test --workspace, while the job now runscargo fetchfollowed bycargo test --workspace --no-fail-fast.Evidence
testrow still readscargo test --workspacecargo fetch+cargo test --workspace --no-fail-fastSuggestion
Update the
testrow to list both commands so the documented CI contract matches the workflow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 80d9bee: the
testrow now readscargo fetch, thencargo test --workspace --no-fail-fast. I updated the same description in the README's CI paragraph.