Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/n] [dropshot] combine integration tests into one binary #1170

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
let mut api = ApiDescription::<usize>::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<()>,
Expand Down
26 changes: 26 additions & 0 deletions dropshot/tests/integration-tests/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
let mut api = ApiDescription::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -571,7 +566,7 @@ lazy_static! {
}

fn make_word_list() -> BTreeSet<String> {
let word_list = include_str!("wordlist.txt");
let word_list = include_str!("../wordlist.txt");
word_list.lines().map(|s| s.to_string()).collect()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
let mut api = ApiDescription::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down