Something went wrong. Try again.
very fast at protocol indexer with flexible filtering, xrpc queries, cursor-backed event stream, and more, built on fjall
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243//! test plumbing the backfill test modules share
use std::net::SocketAddr;
use axum::Router;
use crate::backfill::client::ThrottledHttpClient;use crate::util::throttle::Throttler;
/// serves `app` on a free local port and says wherepub(crate) async fn serve(app: Router) -> SocketAddr { let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); let address = listener.local_addr().unwrap(); tokio::spawn(async move { axum::serve(listener, app).await.unwrap() }); address}
/// a client that reaches the mock pds at `address` through a public hostname, since the/// backfill client refuses private addresses. returns that hostname's url and the clientpub(crate) fn public_client( address: SocketAddr, throttler: &Throttler,) -> (url::Url, ThrottledHttpClient) { let client = reqwest::Client::builder() .resolve("pds.example", address) .build() .unwrap(); let http = ThrottledHttpClient::new( crate::net::PublicHttpClient::test(client), throttler.clone(), ); (url::Url::parse("http://pds.example/").unwrap(), http)}
/// a `sh.tangled.repo` record called `name`pub(crate) fn tangled_repo(name: &str) -> Vec<u8> { serde_ipld_dagcbor::to_vec(&serde_json::json!({ "$type": "sh.tangled.repo", "name": name, })) .unwrap()}