Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 45 additions & 57 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions src/pubsub/src/subscriber/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,4 +1041,31 @@ mod tests {

Ok(())
}

#[tokio::test]
async fn routing_header() -> anyhow::Result<()> {
let mut mock = MockSubscriber::new();

let subscription = "projects/p/subscriptions/s";

mock.expect_streaming_pull().return_once(move |request| {
let metadata = request.metadata();
assert_eq!(
metadata
.get("x-goog-request-params")
.expect("routing header missing"),
&format!("subscription={subscription}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I prefer to spell these out. Less logic in the test.

Suggested change
&format!("subscription={subscription}")
"subscription=projects/p/subscriptions/s"

);
Err(TonicStatus::failed_precondition(
"header verification failed",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we get here, the verification succeeded

Suggested change
"header verification failed",
"ignored",

))
});

let (endpoint, _server) = start("0.0.0.0:0", mock).await?;
let client = test_client(endpoint).await?;

let _ = client.streaming_pull(subscription).start().next().await;

Ok(())
}
}
Loading
Loading