Skip to content

Commit

Permalink
test(conn-id): update seeded fastrand constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jbr committed May 30, 2024
1 parent 8dfe44b commit b1e4202
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions conn-id/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl ConnId {
assert_ok!(
get("/").on(&app),
"ok",
"x-request-id" => "4fekClhof7"
"x-request-id" => "J4lzoPXcT5"
);
assert_headers!(
Expand Down Expand Up @@ -160,7 +160,7 @@ impl ConnId {
assert_headers!(
get("/").on(&app),
"x-custom-header" => "4fekClhof7"
"x-custom-header" => "J4lzoPXcT5"
);
```
*/
Expand Down
12 changes: 6 additions & 6 deletions conn-id/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ use uuid::Uuid;
#[test]
fn test_defaults() {
let app = (ConnId::new().with_seed(1000), "ok");
assert_ok!(get("/").on(&app), "ok", "x-request-id" => "4fekClhof7");
assert_ok!(get("/").on(&app), "ok", "x-request-id" => "PAmkU1LPSe");
assert_ok!(get("/").on(&app), "ok", "x-request-id" => "J4lzoPXcT5");
assert_ok!(get("/").on(&app), "ok", "x-request-id" => "Sn0wUTe4EF");
assert_ok!(
get("/").with_request_header("x-request-id", "inbound-id").on(&app),
"ok",
"x-request-id" => "inbound-id"
);

let conn = get("/").on(&app);
assert_eq!(conn.id(), "kZTgZfbUJB");
assert_eq!(log_formatter::conn_id(&conn, true), "kZTgZfbUJB");
assert_eq!(conn.id(), "cnx2OnqZsR");
assert_eq!(log_formatter::conn_id(&conn, true), "cnx2OnqZsR");

let conn = TestConn::build("get", "/", ());
assert_eq!(log_formatter::conn_id(&conn, true), "-");
Expand Down Expand Up @@ -56,11 +56,11 @@ fn test_no_headers() {

let conn = get("/").on(&app);
assert!(conn.response_headers().get("x-request-id").is_none());
assert_eq!(conn.id(), "4fekClhof7");
assert_eq!(conn.id(), "J4lzoPXcT5");

let conn = get("/")
.with_request_header("x-request-id", "ignored")
.on(&app);
assert_eq!(conn.id(), "PAmkU1LPSe");
assert_eq!(conn.id(), "Sn0wUTe4EF");
assert!(conn.response_headers().get("x-request-id").is_none());
}

0 comments on commit b1e4202

Please sign in to comment.