test(client): update test helpers to handle fallible packet length calculations
This commit is contained in:
9 files changed
+35
-8
No files matched your search
@@ -13,6 +13,8 @@ use support::{
|
||||
start_hmac_required_open_drop_server, BackendPeer, ServerObservation, TOKEN,
|
||||
};
|
||||
|
||||
use crate::support::test_echo_packet_len;
|
||||
|
||||
#[test]
|
||||
fn hmac_open_success_negotiates_without_warnings() {
|
||||
let key = b"compat-secret".to_vec();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
mod support;
|
||||
|
||||
use irtt_client::{Client, ClientConfig, ClientEvent, NegotiationPolicy};
|
||||
use irtt_proto::{echo_header_len, echo_packet_len, Params, TimestampFields};
|
||||
use irtt_proto::{echo_header_len, Params, TimestampFields};
|
||||
|
||||
use support::{config_for_params, default_params, run_one_probe, BackendPeer, ServerObservation};
|
||||
|
||||
use crate::support::test_echo_packet_len;
|
||||
|
||||
fn params_with_length(length: i64) -> Params {
|
||||
Params {
|
||||
length,
|
||||
|
||||
@@ -14,6 +14,8 @@ use support::{
|
||||
ServerObservation, RECV_COUNT, RECV_WINDOW, TOKEN,
|
||||
};
|
||||
|
||||
use crate::support::test_echo_packet_len;
|
||||
|
||||
struct ReplyView<'a> {
|
||||
seq: u32,
|
||||
rtt: &'a RttSample,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
mod support;
|
||||
|
||||
use irtt_client::{Client, ClientConfig, ClientError, ClientEvent, NegotiationPolicy};
|
||||
use irtt_proto::{echo_packet_len, Params, TimestampFields};
|
||||
use irtt_proto::{Params, TimestampFields};
|
||||
|
||||
use support::{
|
||||
config_for_params, default_params, run_one_probe, run_one_probe_with_config, server_fill,
|
||||
start_open_server, OneProbeRun, ServerObservation,
|
||||
};
|
||||
|
||||
use crate::support::test_echo_packet_len;
|
||||
|
||||
fn open_observation_params(run: &OneProbeRun) -> &Params {
|
||||
match &run.observations[0] {
|
||||
ServerObservation::Open { params, .. } => params,
|
||||
|
||||
@@ -520,6 +520,11 @@ fn open_reply(flags: u8, token: u64, params: &Params, hmac_key: Option<&[u8]>) -
|
||||
packet
|
||||
}
|
||||
|
||||
pub(super) fn test_echo_packet_len(hmac: bool, params: &Params) -> usize {
|
||||
echo_packet_len(hmac, params)
|
||||
.expect("managed runner test params must have a non-negative packet length")
|
||||
}
|
||||
|
||||
fn echo_reply_packet(
|
||||
token: u64,
|
||||
seq: u32,
|
||||
|
||||
Reference in new issue
Block a user