test(claude-connector): replay exact TransportInvocation in priced_serve test
This commit is contained in:
parent
80a19bf818
commit
e074b58e4d
1 changed files with 16 additions and 11 deletions
|
|
@ -2203,13 +2203,23 @@ mod tests {
|
|||
}];
|
||||
|
||||
// Call 1: priced request records 1_000_000_000_000 micro-USD on receipt.
|
||||
let r1 = invoke(
|
||||
&client_a,
|
||||
"caller-a",
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_millis() as u64;
|
||||
let mut req1 = model_connector::ProviderRequest::new(
|
||||
"req-priced-1",
|
||||
"conv-daemon-test",
|
||||
"m-priced",
|
||||
user_msg.clone(),
|
||||
"Be brief.",
|
||||
1024,
|
||||
);
|
||||
req1.input = user_msg.clone();
|
||||
let hash1 = model_connector::provider_request_sha256(&req1).unwrap();
|
||||
let inv1 = model_connector::TransportInvocation::new("caller-a", now + 60_000, hash1, req1)
|
||||
.unwrap();
|
||||
let r1 = client_a.execute(&inv1).unwrap();
|
||||
r1.validate_against(&inv1).unwrap();
|
||||
let model_connector::TransportDisposition::Transported { receipt: rec1, .. } =
|
||||
&r1.disposition
|
||||
else {
|
||||
|
|
@ -2218,13 +2228,8 @@ mod tests {
|
|||
assert_eq!(rec1.cost_micro_usd, Some(1_000_000_000_000));
|
||||
|
||||
// Replay of req-priced-1 must not hit the backend or double-count monthly spend.
|
||||
let r1_replay = invoke(
|
||||
&client_a,
|
||||
"caller-a",
|
||||
"req-priced-1",
|
||||
"m-priced",
|
||||
user_msg.clone(),
|
||||
);
|
||||
let r1_replay = client_a.execute(&inv1).unwrap();
|
||||
r1_replay.validate_against(&inv1).unwrap();
|
||||
assert_eq!(r1_replay, r1);
|
||||
|
||||
// Call 2: even at $1,000,000 accumulated spend, a second priced call proceeds without gating.
|
||||
|
|
|
|||
Loading…
Reference in a new issue