From 69b5e67cd1f29a14477822e4b284c1ee235d6703 Mon Sep 17 00:00:00 2001 From: Ameer Ghani Date: Wed, 17 Apr 2024 19:24:09 -0400 Subject: [PATCH] Add integration test for time-bucketed fixed size (#3025) --- Cargo.lock | 24 ++++++------- .../tests/integration/in_cluster.rs | 35 ++++++++++++++++++- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5098f4ca2..1b0983e32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1226,13 +1226,13 @@ dependencies = [ [[package]] name = "divviup-client" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f3b8ea9d2af56a3e7821f5eb07930688c97be58c431e4a6920d27b3893530" +checksum = "ecacbabd66def525c90cb0e9c0d6665d59c10ff22d87bf3f3d58d17329e4986c" dependencies = [ "base64 0.22.0", "email_address", - "janus_messages 0.7.2", + "janus_messages 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "log", "pad-adapter", "serde", @@ -2649,11 +2649,10 @@ dependencies = [ [[package]] name = "janus_messages" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "425b77ad31e0614c16041aa44c4014ebd4c67544d01135cece4f51c33b4adef2" +version = "0.7.5" dependencies = [ "anyhow", + "assert_matches", "base64 0.22.0", "derivative", "hex", @@ -2661,6 +2660,7 @@ dependencies = [ "prio", "rand", "serde", + "serde_test", "thiserror", "url", ] @@ -2668,9 +2668,10 @@ dependencies = [ [[package]] name = "janus_messages" version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd629c85e8ff09303b2bfccb15e7ae07adb716a998d9124b312f988afbd8b5b5" dependencies = [ "anyhow", - "assert_matches", "base64 0.22.0", "derivative", "hex", @@ -2678,7 +2679,6 @@ dependencies = [ "prio", "rand", "serde", - "serde_test", "thiserror", "url", ] @@ -5049,9 +5049,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -5070,9 +5070,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", diff --git a/integration_tests/tests/integration/in_cluster.rs b/integration_tests/tests/integration/in_cluster.rs index 27ef9b56b..ce629a179 100644 --- a/integration_tests/tests/integration/in_cluster.rs +++ b/integration_tests/tests/integration/in_cluster.rs @@ -18,10 +18,11 @@ use janus_core::{ install_test_trace_subscriber, kubernetes::{Cluster, PortForward}, }, + time::DurationExt, vdaf::VdafInstance, }; use janus_integration_tests::{client::ClientBackend, TaskParameters}; -use janus_messages::TaskId; +use janus_messages::{Duration as JanusDuration, TaskId}; use std::{env, str::FromStr, time::Duration}; use trillium_rustls::RustlsConfig; use trillium_tokio::ClientConfig; @@ -424,6 +425,13 @@ impl InClusterJanusPair { QueryType::TimeInterval => None, QueryType::FixedSize { max_batch_size, .. } => *max_batch_size, }, + batch_time_window_size_seconds: match task.query_type() { + QueryType::TimeInterval => None, + QueryType::FixedSize { + batch_time_window_size, + .. + } => batch_time_window_size.map(|window| window.as_seconds()), + }, time_precision_seconds: task.time_precision().as_seconds(), collector_credential_id, }; @@ -559,6 +567,31 @@ async fn in_cluster_fixed_size() { .await; } +#[tokio::test(flavor = "multi_thread")] +async fn in_cluster_time_bucketed_fixed_size() { + install_test_trace_subscriber(); + initialize_rustls(); + + // Start port forwards and set up task. + let janus_pair = InClusterJanusPair::new( + VdafInstance::Prio3Count, + QueryType::FixedSize { + max_batch_size: Some(110), + batch_time_window_size: Some(JanusDuration::from_hours(8).unwrap()), + }, + ) + .await; + + // Run the behavioral test. + submit_measurements_and_verify_aggregate( + "in_cluster_time_bucketed_fixed_size", + &janus_pair.task_parameters, + (janus_pair.leader.port(), janus_pair.helper.port()), + &ClientBackend::InProcess, + ) + .await; +} + #[cfg(feature = "in-cluster-rate-limits")] mod rate_limits { use super::InClusterJanusPair;