Skip to content

Commit

Permalink
update to Dropshot 0.13.0 (minimum changes) (#7050)
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco authored Nov 14, 2024
1 parent 63bf8cc commit 3cbc953
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 81 deletions.
177 changes: 123 additions & 54 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ dns-server = { path = "dns-server" }
dns-server-api = { path = "dns-server-api" }
dns-service-client = { path = "clients/dns-service-client" }
dpd-client = { path = "clients/dpd-client" }
dropshot = { version = "0.12.0", features = [ "usdt-probes" ] }
dropshot = { version = "0.13.0", features = [ "usdt-probes" ] }
dyn-clone = "1.0.17"
either = "1.13.0"
expectorate = "1.1.0"
Expand Down Expand Up @@ -814,7 +814,7 @@ opt-level = 3
# It's common during development to use a local copy of various complex
# dependencies. If you want to use those, uncomment one of these blocks.
#
#[patch."https://github.com/oxidecomputer/dropshot"]
#[patch."crates-io"]
#dropshot = { path = "../dropshot/dropshot" }
#[patch.crates-io]
#steno = { path = "../steno" }
Expand Down
1 change: 1 addition & 0 deletions dev-tools/openapi-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ openapiv3.workspace = true
owo-colors.workspace = true
oximeter-api.workspace = true
repo-depot-api.workspace = true
semver.workspace = true
serde_json.workspace = true
similar.workspace = true
sled-agent-api.workspace = true
Expand Down
31 changes: 16 additions & 15 deletions dev-tools/openapi-manager/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
vec![
ApiSpec {
title: "Bootstrap Agent API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "Per-sled API for setup and teardown",
boundary: ApiBoundary::Internal,
api_description:
Expand All @@ -28,7 +28,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "ClickHouse Cluster Admin Keeper API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with the Oxide \
control plane's ClickHouse cluster keepers",
boundary: ApiBoundary::Internal,
Expand All @@ -39,7 +39,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "ClickHouse Cluster Admin Server API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with the Oxide \
control plane's ClickHouse cluster replica servers",
boundary: ApiBoundary::Internal,
Expand All @@ -50,7 +50,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "CockroachDB Cluster Admin API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with the Oxide \
control plane's CockroachDB cluster",
boundary: ApiBoundary::Internal,
Expand All @@ -61,7 +61,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide Management Gateway Service API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with the Oxide \
control plane's gateway service",
boundary: ApiBoundary::Internal,
Expand All @@ -72,7 +72,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Internal DNS",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for the internal DNS server",
boundary: ApiBoundary::Internal,
api_description:
Expand All @@ -82,7 +82,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Installinator API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for installinator to fetch artifacts \
and report progress",
boundary: ApiBoundary::Internal,
Expand All @@ -93,7 +93,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide Region API",
version: "20241204.0",
version: semver::Version::new(20241204, 0, 0),
description: "API for interacting with the Oxide control plane",
boundary: ApiBoundary::External,
api_description:
Expand All @@ -103,7 +103,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Nexus internal API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "Nexus internal API",
boundary: ApiBoundary::Internal,
api_description:
Expand All @@ -113,7 +113,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide Oximeter API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with oximeter",
boundary: ApiBoundary::Internal,
api_description:
Expand All @@ -123,7 +123,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide TUF Repo Depot API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for fetching update artifacts",
boundary: ApiBoundary::Internal,
api_description: repo_depot_api::repo_depot_api_mod::stub_api_description,
Expand All @@ -132,7 +132,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide Sled Agent API",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for interacting with individual sleds",
boundary: ApiBoundary::Internal,
api_description:
Expand All @@ -142,7 +142,7 @@ pub fn all_apis() -> Vec<ApiSpec> {
},
ApiSpec {
title: "Oxide Technician Port Control Service",
version: "0.0.1",
version: semver::Version::new(0, 0, 1),
description: "API for use by the technician port TUI: wicket",
boundary: ApiBoundary::Internal,
api_description: wicketd_api::wicketd_api_mod::stub_api_description,
Expand All @@ -158,7 +158,7 @@ pub struct ApiSpec {
pub title: &'static str,

/// The version.
pub version: &'static str,
pub version: semver::Version,

/// The description string.
pub description: &'static str,
Expand Down Expand Up @@ -251,7 +251,8 @@ impl ApiSpec {
// impl formats the errors appropriately.
anyhow::anyhow!("{}", error)
})?;
let mut openapi_def = description.openapi(&self.title, &self.version);
let mut openapi_def =
description.openapi(&self.title, self.version.clone());
openapi_def
.description(&self.description)
.contact_url("https://oxide.computer")
Expand Down
1 change: 1 addition & 0 deletions internal-dns/resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ expectorate.workspace = true
omicron-test-utils.workspace = true
omicron-uuid-kinds.workspace = true
progenitor.workspace = true
semver.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
sled.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion internal-dns/resolver/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ mod test {
// Progenitor client.
fn expect_openapi_json_valid_for_test_server() {
let api = api();
let openapi = api.openapi("Test Server", "v0.1.0");
let openapi = api.openapi("Test Server", semver::Version::new(0, 1, 0));
let mut output = std::io::Cursor::new(Vec::new());
openapi.write(&mut output).unwrap();
expectorate::assert_contents(
Expand Down
2 changes: 1 addition & 1 deletion internal-dns/resolver/tests/output/test-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "Test Server",
"version": "v0.1.0"
"version": "0.1.0"
},
"paths": {
"/test": {
Expand Down
2 changes: 1 addition & 1 deletion nexus/external-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use omicron_common::api::external::{
use openapi_manager_types::ValidationContext;
use openapiv3::OpenAPI;

pub const API_VERSION: &str = "20241204.0";
pub const API_VERSION: &str = "20241204.0.0";

// API ENDPOINT FUNCTION NAMING CONVENTIONS
//
Expand Down
1 change: 1 addition & 0 deletions nexus/test-utils/src/http_testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl<'a> RequestBuilder<'a> {
body: dropshot::Body::empty(),
expected_status: None,
allowed_headers: Some(vec![
http::header::CONNECTION,
http::header::CONTENT_ENCODING,
http::header::CONTENT_LENGTH,
http::header::CONTENT_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://oxide.computer",
"email": "[email protected]"
},
"version": "20241204.0"
"version": "20241204.0.0"
},
"paths": {
"/device/auth": {
Expand Down
1 change: 1 addition & 0 deletions oximeter/collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ qorb.workspace = true
rand.workspace = true
reqwest = { workspace = true, features = [ "json" ] }
schemars.workspace = true
semver.workspace = true
serde.workspace = true
slog.workspace = true
slog-async.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion oximeter/collector/src/bin/oximeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use uuid::Uuid;

pub fn run_standalone_openapi() -> Result<(), String> {
standalone_nexus_api()
.openapi("Oxide Nexus API", "0.0.1")
.openapi("Oxide Nexus API", semver::Version::new(0, 0, 1))
.description("API for interacting with Nexus")
.contact_url("https://oxide.computer")
.contact_email("[email protected]")
Expand Down
1 change: 1 addition & 0 deletions sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ omicron-test-utils.workspace = true
pretty_assertions.workspace = true
rcgen.workspace = true
reqwest = { workspace = true, features = ["blocking"] }
semver.workspace = true
subprocess.workspace = true
slog-async.workspace = true
slog-term.workspace = true
Expand Down
5 changes: 4 additions & 1 deletion sled-agent/src/sim/http_entrypoints_pantry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,10 @@ mod tests {
let Value::String(ref version) = real_api["info"]["version"] else {
unreachable!();
};
let sim_api = super::api().openapi(title, version).json().unwrap();
let sim_api = super::api()
.openapi(title, version.parse().unwrap())
.json()
.unwrap();

// We'll assert that anything which apppears in the simulated API must
// appear exactly as-is in the real API. I.e., the simulated is a subset
Expand Down
8 changes: 4 additions & 4 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ hashbrown = { version = "0.15.0" }
hex = { version = "0.4.3", features = ["serde"] }
hickory-proto = { version = "0.24.1", features = ["text-parsing"] }
hmac = { version = "0.12.1", default-features = false, features = ["reset"] }
hyper = { version = "1.4.1", features = ["full"] }
hyper = { version = "1.5.0", features = ["full"] }
indexmap = { version = "2.6.0", features = ["serde"] }
inout = { version = "0.1.3", default-features = false, features = ["std"] }
itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12.1" }
Expand Down Expand Up @@ -130,7 +130,7 @@ unicode-bidi = { version = "0.3.17" }
unicode-normalization = { version = "0.1.24" }
usdt = { version = "0.5.0" }
usdt-impl = { version = "0.5.0", default-features = false, features = ["asm", "des"] }
uuid = { version = "1.10.0", features = ["serde", "v4"] }
uuid = { version = "1.11.0", features = ["serde", "v4"] }
x509-cert = { version = "0.2.5" }
zerocopy = { version = "0.7.35", features = ["derive", "simd"] }
zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] }
Expand Down Expand Up @@ -186,7 +186,7 @@ hashbrown = { version = "0.15.0" }
hex = { version = "0.4.3", features = ["serde"] }
hickory-proto = { version = "0.24.1", features = ["text-parsing"] }
hmac = { version = "0.12.1", default-features = false, features = ["reset"] }
hyper = { version = "1.4.1", features = ["full"] }
hyper = { version = "1.5.0", features = ["full"] }
indexmap = { version = "2.6.0", features = ["serde"] }
inout = { version = "0.1.3", default-features = false, features = ["std"] }
itertools-5ef9efb8ec2df382 = { package = "itertools", version = "0.12.1" }
Expand Down Expand Up @@ -253,7 +253,7 @@ unicode-normalization = { version = "0.1.24" }
unicode-xid = { version = "0.2.6" }
usdt = { version = "0.5.0" }
usdt-impl = { version = "0.5.0", default-features = false, features = ["asm", "des"] }
uuid = { version = "1.10.0", features = ["serde", "v4"] }
uuid = { version = "1.11.0", features = ["serde", "v4"] }
x509-cert = { version = "0.2.5" }
zerocopy = { version = "0.7.35", features = ["derive", "simd"] }
zeroize = { version = "1.8.1", features = ["std", "zeroize_derive"] }
Expand Down

0 comments on commit 3cbc953

Please sign in to comment.