diff --git a/integration_tests/src/daphne.rs b/integration_tests/src/daphne.rs index 2f1237413..a81983b37 100644 --- a/integration_tests/src/daphne.rs +++ b/integration_tests/src/daphne.rs @@ -10,11 +10,11 @@ use serde_json::json; use testcontainers::{clients::Cli, GenericImage, RunnableImage}; use url::Url; -const DAPHNE_HELPER_IMAGE_NAME_AND_TAG: &str = "cloudflare/daphne-worker-helper:sha-f6b3ef1"; +const DAPHNE_HELPER_IMAGE_NAME_AND_TAG: &str = "cloudflare/daphne-worker-helper:sha-4c612db"; /// Represents a running Daphne test instance. pub struct Daphne<'a> { - daphne_container: Option>, + daphne_container: ContainerLogsDropGuard<'a, GenericImage>, } impl<'a> Daphne<'a> { @@ -28,7 +28,6 @@ impl<'a> Daphne<'a> { network: &str, task: &Task, role: Role, - start_container: bool, ) -> Daphne<'a> { let (endpoint, image_name_and_tag) = match role { Role::Leader => panic!("A leader container image for Daphne is not yet available"), @@ -43,22 +42,17 @@ impl<'a> Daphne<'a> { .unwrap_or((image_name_and_tag, "latest")); // Start the Daphne test container running. - let (port, daphne_container) = if start_container { - let runnable_image = RunnableImage::from(GenericImage::new(image_name, image_tag)) - .with_network(network) - // Daphne uses the DAP_TRACING environment variable for its tracing subscriber. - .with_env_var(("DAP_TRACING", get_rust_log_level().1)) - .with_container_name(endpoint.host_str().unwrap()); - let daphne_container = ContainerLogsDropGuard::new( - test_name, - container_client.run(runnable_image), - ContainerLogsSource::Path("/logs".into()), - ); - let port = daphne_container.get_host_port_ipv4(Self::INTERNAL_SERVING_PORT); - (port, Some(daphne_container)) - } else { - (Self::INTERNAL_SERVING_PORT, None) - }; + let runnable_image = RunnableImage::from(GenericImage::new(image_name, image_tag)) + .with_network(network) + // Daphne uses the DAP_TRACING environment variable for its tracing subscriber. + .with_env_var(("DAP_TRACING", get_rust_log_level().1)) + .with_container_name(endpoint.host_str().unwrap()); + let daphne_container = ContainerLogsDropGuard::new( + test_name, + container_client.run(runnable_image), + ContainerLogsSource::Path("/logs".into()), + ); + let port = daphne_container.get_host_port_ipv4(Self::INTERNAL_SERVING_PORT); // Wait for Daphne container to begin listening on the port. await_ready_ok(port).await; @@ -129,9 +123,6 @@ impl<'a> Daphne<'a> { /// Returns the port of the aggregator on the host. pub fn port(&self) -> u16 { self.daphne_container - .as_ref() - .map_or(Self::INTERNAL_SERVING_PORT, |container| { - container.get_host_port_ipv4(Self::INTERNAL_SERVING_PORT) - }) + .get_host_port_ipv4(Self::INTERNAL_SERVING_PORT) } } diff --git a/integration_tests/tests/integration/daphne.rs b/integration_tests/tests/integration/daphne.rs index 75ddd1497..538c3f6a1 100644 --- a/integration_tests/tests/integration/daphne.rs +++ b/integration_tests/tests/integration/daphne.rs @@ -48,15 +48,7 @@ async fn daphne_janus() { .build(); let container_client = container_client(); - let leader = Daphne::new( - TEST_NAME, - &container_client, - &network, - &task, - Role::Leader, - true, - ) - .await; + let leader = Daphne::new(TEST_NAME, &container_client, &network, &task, Role::Leader).await; let helper = JanusContainer::new(TEST_NAME, &container_client, &network, &task, Role::Helper).await; @@ -72,7 +64,6 @@ async fn daphne_janus() { // This test places Janus in the leader role & Daphne in the helper role. #[tokio::test(flavor = "multi_thread")] -#[ignore = "Daphne does not currently support DAP-07 (issue #1669)"] #[cfg(feature = "testcontainer")] async fn janus_daphne() { static TEST_NAME: &str = "janus_daphne"; @@ -102,15 +93,7 @@ async fn janus_daphne() { let container_client = container_client(); let leader = JanusContainer::new(TEST_NAME, &container_client, &network, &task, Role::Leader).await; - let helper = Daphne::new( - TEST_NAME, - &container_client, - &network, - &task, - Role::Helper, - true, - ) - .await; + let helper = Daphne::new(TEST_NAME, &container_client, &network, &task, Role::Helper).await; // Run the behavioral test. submit_measurements_and_verify_aggregate( @@ -125,7 +108,6 @@ async fn janus_daphne() { /// This test places Janus in the leader role and Daphne in the helper role. Janus is run /// in-process, while Daphne is run in Docker. #[tokio::test(flavor = "multi_thread")] -#[ignore = "Daphne does not currently support DAP-07 (issue #1669)"] async fn janus_in_process_daphne() { static TEST_NAME: &str = "janus_in_process_daphne"; install_test_trace_subscriber(); @@ -153,7 +135,6 @@ async fn janus_in_process_daphne() { &network, &task_builder.clone().build(), Role::Helper, - true, ) .await; task_builder = task_builder.with_helper_aggregator_endpoint(