test: Refactor log entry parsing integration test to use new api client
This commit is contained in:
parent
03f4151f66
commit
c46dfd4457
1 changed files with 13 additions and 26 deletions
|
@ -2,41 +2,28 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use base64ct::Encoding;
|
use base64ct::Encoding;
|
||||||
use ct::{
|
use ct::{
|
||||||
merkle::{
|
api::{responses::GetEntriesResponseEntry, CtApiClient}, merkle::{
|
||||||
consts::EXTRA_DATA_BASE64_BUFFER_SIZE,
|
consts::EXTRA_DATA_BASE64_BUFFER_SIZE,
|
||||||
types::{MerkleLeafType, Version}
|
types::{MerkleLeafType, Version}
|
||||||
},
|
}, parsing::entry::{parse_entry_extra_data_precert, parse_entry_extra_data_x509}
|
||||||
parsing::entry::{parse_entry_extra_data_precert, parse_entry_extra_data_x509}
|
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
|
||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
async fn fetch_entries() -> impl Iterator<Item = GetEntriesResponseEntry> {
|
||||||
pub struct Entry {
|
let client = Arc::new(
|
||||||
leaf_input: String,
|
CtApiClient::new_with_client(
|
||||||
extra_data: String
|
"https://oak.ct.letsencrypt.org/2024h2/ct/v1/get-entries",
|
||||||
}
|
Arc::new(reqwest::Client::new())
|
||||||
|
)
|
||||||
#[derive(Debug, Deserialize)]
|
);
|
||||||
pub struct GetEntriesResponse {
|
let mut join_set: JoinSet<_> = JoinSet::new();
|
||||||
entries: Vec<Entry>
|
for i in 0..12u64 {
|
||||||
}
|
|
||||||
|
|
||||||
async fn fetch_entries() -> impl Iterator<Item = Entry> {
|
|
||||||
let client = Arc::new(reqwest::Client::new());
|
|
||||||
let mut join_set: JoinSet<GetEntriesResponse> = JoinSet::new();
|
|
||||||
for i in 0..12u32 {
|
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
join_set.spawn(async move {
|
join_set.spawn(async move {
|
||||||
client
|
client
|
||||||
.get("https://oak.ct.letsencrypt.org/2024h2/ct/v1/get-entries")
|
.get_log_entries(i * 256, (i+1) * 256 - 1)
|
||||||
.query(&[("start", i * 256), ("end", (i + 1) * 256 - 1)])
|
|
||||||
.send()
|
|
||||||
.await
|
.await
|
||||||
.expect("Request to ct log should succeed")
|
.expect("Request should succeed")
|
||||||
.json()
|
|
||||||
.await
|
|
||||||
.expect("Request to ct log should parse properly")
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
join_set
|
join_set
|
||||||
|
|
Loading…
Reference in a new issue