diff --git a/dropshot/tests/test_api_trait.rs b/dropshot/tests/integration-tests/api_trait.rs similarity index 100% rename from dropshot/tests/test_api_trait.rs rename to dropshot/tests/integration-tests/api_trait.rs diff --git a/dropshot/tests/common/mod.rs b/dropshot/tests/integration-tests/common.rs similarity index 100% rename from dropshot/tests/common/mod.rs rename to dropshot/tests/integration-tests/common.rs diff --git a/dropshot/tests/test_config.rs b/dropshot/tests/integration-tests/config.rs similarity index 99% rename from dropshot/tests/test_config.rs rename to dropshot/tests/integration-tests/config.rs index 694818742..affa9a8b6 100644 --- a/dropshot/tests/test_config.rs +++ b/dropshot/tests/integration-tests/config.rs @@ -16,8 +16,7 @@ use std::sync::atomic::{AtomicU16, Ordering}; use tempfile::NamedTempFile; use tokio::sync::mpsc; -pub mod common; -use common::create_log_context; +use crate::common::{self, create_log_context}; // Bad values for "bind_address" diff --git a/dropshot/tests/test_demo.rs b/dropshot/tests/integration-tests/demo.rs similarity index 99% rename from dropshot/tests/test_demo.rs rename to dropshot/tests/integration-tests/demo.rs index 6d26d047e..4c692c1c7 100644 --- a/dropshot/tests/test_demo.rs +++ b/dropshot/tests/integration-tests/demo.rs @@ -58,9 +58,9 @@ use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::WebSocketStream; use uuid::Uuid; -extern crate slog; +use crate::common; -pub mod common; +extern crate slog; fn demo_api() -> ApiDescription { let mut api = ApiDescription::::new(); diff --git a/dropshot/tests/test_detached_shutdown.rs b/dropshot/tests/integration-tests/detached_shutdown.rs similarity index 99% rename from dropshot/tests/test_detached_shutdown.rs rename to dropshot/tests/integration-tests/detached_shutdown.rs index 2c11f7fbe..edfa66825 100644 --- a/dropshot/tests/test_detached_shutdown.rs +++ b/dropshot/tests/integration-tests/detached_shutdown.rs @@ -11,7 +11,7 @@ use http::{Method, Response, StatusCode}; use std::time::Duration; use tokio::sync::mpsc; -pub mod common; +use crate::common; struct Context { endpoint_started_tx: mpsc::UnboundedSender<()>, diff --git a/dropshot/tests/integration-tests/main.rs b/dropshot/tests/integration-tests/main.rs new file mode 100644 index 000000000..cd28c6818 --- /dev/null +++ b/dropshot/tests/integration-tests/main.rs @@ -0,0 +1,26 @@ +// Copyright 2024 Oxide Computer Company + +//! Integration tests for Dropshot. +//! +//! These are all combined into the same file to ensure that a single binary is +//! generated, speeding up link times. + +#[macro_use] +extern crate slog; +#[macro_use] +extern crate lazy_static; + +mod api_trait; +mod common; +mod config; +mod demo; +mod detached_shutdown; +mod multipart; +mod openapi; +mod pagination; +mod pagination_schema; +mod path_names; +mod starter; +mod streaming; +mod tls; +mod versions; diff --git a/dropshot/tests/test_multipart.rs b/dropshot/tests/integration-tests/multipart.rs similarity index 99% rename from dropshot/tests/test_multipart.rs rename to dropshot/tests/integration-tests/multipart.rs index 3728ce501..2ec40734e 100644 --- a/dropshot/tests/test_multipart.rs +++ b/dropshot/tests/integration-tests/multipart.rs @@ -8,9 +8,9 @@ use dropshot::{ }; use http::{Method, Response, StatusCode}; -extern crate slog; +use crate::common; -pub mod common; +extern crate slog; fn api() -> ApiDescription { let mut api = ApiDescription::new(); diff --git a/dropshot/tests/test_openapi.rs b/dropshot/tests/integration-tests/openapi.rs similarity index 100% rename from dropshot/tests/test_openapi.rs rename to dropshot/tests/integration-tests/openapi.rs diff --git a/dropshot/tests/test_pagination.rs b/dropshot/tests/integration-tests/pagination.rs similarity index 99% rename from dropshot/tests/test_pagination.rs rename to dropshot/tests/integration-tests/pagination.rs index 51d3d3ab0..3e443fa70 100644 --- a/dropshot/tests/test_pagination.rs +++ b/dropshot/tests/integration-tests/pagination.rs @@ -46,12 +46,7 @@ use subprocess::NullFile; use subprocess::Popen; use uuid::Uuid; -#[macro_use] -extern crate slog; -#[macro_use] -extern crate lazy_static; - -pub mod common; +use crate::common; // Common helpers @@ -571,7 +566,7 @@ lazy_static! { } fn make_word_list() -> BTreeSet { - let word_list = include_str!("wordlist.txt"); + let word_list = include_str!("../wordlist.txt"); word_list.lines().map(|s| s.to_string()).collect() } diff --git a/dropshot/tests/test_pagination_schema.rs b/dropshot/tests/integration-tests/pagination_schema.rs similarity index 100% rename from dropshot/tests/test_pagination_schema.rs rename to dropshot/tests/integration-tests/pagination_schema.rs diff --git a/dropshot/tests/test_path_names.rs b/dropshot/tests/integration-tests/path_names.rs similarity index 100% rename from dropshot/tests/test_path_names.rs rename to dropshot/tests/integration-tests/path_names.rs diff --git a/dropshot/tests/test_starter.rs b/dropshot/tests/integration-tests/starter.rs similarity index 98% rename from dropshot/tests/test_starter.rs rename to dropshot/tests/integration-tests/starter.rs index bb90ef522..a1fa4b0c9 100644 --- a/dropshot/tests/test_starter.rs +++ b/dropshot/tests/integration-tests/starter.rs @@ -3,9 +3,6 @@ //! Quick check that the "legacy" HttpServerStarter::new() and //! HttpServerStarter::new_with_tls() interfaces work. -pub mod common; - -use common::create_log_context; use dropshot::endpoint; use dropshot::test_util::read_json; use dropshot::test_util::ClientTestContext; @@ -17,6 +14,9 @@ use dropshot::HttpResponseOk; use dropshot::HttpServerStarter; use dropshot::RequestContext; +use crate::common; +use crate::common::create_log_context; + extern crate slog; /// Test starting a server with `HttpServerStarter::new()`. diff --git a/dropshot/tests/test_streaming.rs b/dropshot/tests/integration-tests/streaming.rs similarity index 99% rename from dropshot/tests/test_streaming.rs rename to dropshot/tests/integration-tests/streaming.rs index fffa51bef..718fd8f2e 100644 --- a/dropshot/tests/test_streaming.rs +++ b/dropshot/tests/integration-tests/streaming.rs @@ -8,9 +8,9 @@ use http::{Method, Response, StatusCode}; use http_body_util::BodyExt; use tokio::io::{AsyncSeekExt, AsyncWriteExt}; -extern crate slog; +use crate::common; -pub mod common; +extern crate slog; fn api() -> ApiDescription { let mut api = ApiDescription::new(); diff --git a/dropshot/tests/test_tls.rs b/dropshot/tests/integration-tests/tls.rs similarity index 99% rename from dropshot/tests/test_tls.rs rename to dropshot/tests/integration-tests/tls.rs index 9ac700ca9..d6c27bfc4 100644 --- a/dropshot/tests/test_tls.rs +++ b/dropshot/tests/integration-tests/tls.rs @@ -13,10 +13,7 @@ use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -pub mod common; -use common::create_log_context; - -use crate::common::generate_tls_key; +use crate::common::{self, create_log_context, generate_tls_key}; /// See rustls::client::ServerCertVerifier::verify_server_cert for argument /// meanings diff --git a/dropshot/tests/test_versions.rs b/dropshot/tests/integration-tests/versions.rs similarity index 99% rename from dropshot/tests/test_versions.rs rename to dropshot/tests/integration-tests/versions.rs index 6b03af4d5..d9071ee6b 100644 --- a/dropshot/tests/test_versions.rs +++ b/dropshot/tests/integration-tests/versions.rs @@ -19,7 +19,7 @@ use serde::Deserialize; use serde::Serialize; use std::io::Cursor; -pub mod common; +use crate::common; const VERSION_HEADER_NAME: &str = "dropshot-test-version"; const HANDLER1_MSG: &str = "handler1";