Skip to content

Commit a628762

Browse files
authored
Merge integration tests together (#497)
1 parent 0e9e790 commit a628762

20 files changed

+63
-48
lines changed

nexus/tests/test_authn_http.rs renamed to nexus/tests/integration_tests/authn_http.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// a lower-level interface, since our hyper Client will not allow us to send
99
// such invalid requests.
1010

11-
pub mod common;
11+
use super::common;
1212

1313
use async_trait::async_trait;
1414
use chrono::{DateTime, Duration, Utc};
@@ -30,9 +30,6 @@ use std::collections::HashMap;
3030
use std::sync::{Arc, Mutex};
3131
use uuid::Uuid;
3232

33-
#[macro_use]
34-
extern crate slog;
35-
3633
/// Tests authn::external::Authenticator with the "spoof" scheme allowed
3734
///
3835
/// This does not use Nexus or any of the rest of Omicron. It sets up its own

nexus/tests/test_authz.rs renamed to nexus/tests/integration_tests/authz.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
use common::http_testing::RequestBuilder;
77
use dropshot::HttpErrorResponseBody;
88

9-
pub mod common;
9+
use super::common;
1010
use common::test_setup;
1111
use http::method::Method;
1212
use http::StatusCode;
1313
use omicron_common::api::external::IdentityMetadataCreateParams;
1414
use omicron_nexus::authn::external::spoof::HTTP_HEADER_OXIDE_AUTHN_SPOOF;
1515
use omicron_nexus::external_api::params;
1616

17-
extern crate slog;
18-
1917
// TODO-coverage It would be nice to have tests that attempt to hit every
2018
// OpenAPI endpoint with valid arguments and:
2119
// (a) missing credentials (should all fail with 401, 403, or 404)

nexus/tests/test_basic.rs renamed to nexus/tests/integration_tests/basic.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use omicron_nexus::external_api::{
2727
use serde::Serialize;
2828
use uuid::Uuid;
2929

30-
pub mod common;
30+
use super::common;
3131
use common::http_testing::AuthnMode;
3232
use common::http_testing::NexusRequest;
3333
use common::http_testing::RequestBuilder;
@@ -36,9 +36,6 @@ use common::resource_helpers::create_project;
3636
use common::start_sled_agent;
3737
use common::test_setup;
3838

39-
#[macro_use]
40-
extern crate slog;
41-
4239
#[tokio::test]
4340
async fn test_basic_failures() {
4441
let testctx = test_setup("basic_failures").await;

nexus/tests/test_commands.rs renamed to nexus/tests/integration_tests/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn run_command_with_arg(arg: &str) -> (String, String) {
101101
* purpose. However, it's not clear how to reliably locate it at runtime.
102102
* But we do know where it is at compile time, so we load it then.
103103
*/
104-
let config = include_str!("../examples/config.toml");
104+
let config = include_str!("../../examples/config.toml");
105105
let config_path = write_config(config);
106106
let exec = Exec::cmd(path_to_nexus()).arg(&config_path).arg(arg);
107107
let (exit_status, stdout_text, stderr_text) = run_command(exec);

nexus/tests/test_console_api.rs renamed to nexus/tests/integration_tests/console_api.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ use http::header::HeaderName;
77
use http::{header, method::Method, StatusCode};
88
use std::env::current_dir;
99

10-
pub mod common;
10+
use super::common;
1111
use common::http_testing::{RequestBuilder, TestResponse};
1212
use common::{load_test_config, test_setup, test_setup_with_config};
1313
use omicron_common::api::external::IdentityMetadataCreateParams;
1414
use omicron_nexus::external_api::console_api::LoginParams;
1515
use omicron_nexus::external_api::params::OrganizationCreate;
1616

17-
extern crate slog;
18-
1917
#[tokio::test]
2018
async fn test_sessions() {
2119
let cptestctx = test_setup("test_sessions").await;

nexus/tests/test_datasets.rs renamed to nexus/tests/integration_tests/datasets.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ use omicron_nexus::internal_api::params::{
1111
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
1212
use uuid::Uuid;
1313

14-
pub mod common;
14+
use super::common;
1515
use common::{test_setup, SLED_AGENT_UUID};
1616

17-
extern crate slog;
18-
1917
// Tests the "normal" case of dataset_put: inserting a dataset within a known
2018
// zpool.
2119
//

nexus/tests/test_disks.rs renamed to nexus/tests/integration_tests/disks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use dropshot::test_util::objects_post;
2727
use dropshot::test_util::read_json;
2828
use dropshot::test_util::ClientTestContext;
2929

30-
pub mod common;
30+
use super::common;
3131
use common::http_testing::AuthnMode;
3232
use common::http_testing::NexusRequest;
3333
use common::http_testing::RequestBuilder;

nexus/tests/test_instances.rs renamed to nexus/tests/integration_tests/instances.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use dropshot::test_util::objects_post;
2626
use dropshot::test_util::read_json;
2727
use dropshot::test_util::ClientTestContext;
2828

29-
pub mod common;
29+
use super::common;
3030
use common::identity_eq;
3131
use common::resource_helpers::{create_organization, create_project};
3232
use common::test_setup;

nexus/tests/integration_tests/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! Nexus integration tests
2+
//!
3+
//! See the driver in the parent directory for how and why this is structured
4+
//! the way it is.
5+
6+
use super::common;
7+
8+
mod authn_http;
9+
mod authz;
10+
mod basic;
11+
mod commands;
12+
mod console_api;
13+
mod datasets;
14+
mod disks;
15+
mod instances;
16+
mod organizations;
17+
mod oximeter;
18+
mod projects;
19+
mod router_routes;
20+
mod users_builtin;
21+
mod vpc_firewall;
22+
mod vpc_routers;
23+
mod vpc_subnets;
24+
mod vpcs;
25+
mod zpools;

nexus/tests/test_organizations.rs renamed to nexus/tests/integration_tests/organizations.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ use omicron_nexus::external_api::views::Organization;
66

77
use dropshot::test_util::{object_delete, object_get};
88

9-
pub mod common;
9+
use super::common;
1010
use common::resource_helpers::{
1111
create_organization, create_project, objects_list_page_authz,
1212
};
1313
use common::test_setup;
1414
use http::method::Method;
1515
use http::StatusCode;
1616

17-
extern crate slog;
18-
1917
#[tokio::test]
2018
async fn test_organizations() {
2119
let cptestctx = test_setup("test_organizations").await;

0 commit comments

Comments
 (0)