Skip to content

Commit

Permalink
move oximeter-schema binary to oximeter-schema crate
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
sunshowers committed Aug 17, 2024
2 parents 6f34643 + c86ff79 commit dc79778
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 35 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions dev-tools/omdb/tests/test_all_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn assert_oximeter_list_producers_output(

#[tokio::test]
async fn test_omdb_usage_errors() {
clear_omdb_env();
let cmd_path = path_to_executable(CMD_OMDB);
let mut output = String::new();
let invocations: &[&[&'static str]] = &[
Expand Down Expand Up @@ -111,6 +112,8 @@ async fn test_omdb_usage_errors() {

#[nexus_test]
async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
clear_omdb_env();

let gwtestctx = gateway_test_utils::setup::test_setup(
"test_omdb_success_case",
gateway_messages::SpPort::One,
Expand Down Expand Up @@ -271,6 +274,8 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
/// that's covered by the success tests above.
#[nexus_test]
async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
clear_omdb_env();

let cmd_path = path_to_executable(CMD_OMDB);
let postgres_url = cptestctx.database.listen_url().to_string();
let nexus_internal_url =
Expand Down Expand Up @@ -504,3 +509,22 @@ async fn do_run_extra<F>(

write!(output, "=============================================\n").unwrap();
}

// We're testing behavior that can be affected by OMDB-related environment
// variables. Clear all of them from the current process so that all child
// processes don't have them. OMDB environment variables can affect even the
// help output provided by clap. See clap-rs/clap#5673 for an example.
fn clear_omdb_env() {
// Rust documents that it's not safe to manipulate the environment in a
// multi-threaded process outside of Windows because it's possible that
// other threads are reading or writing the environment and most systems do
// not support this. On illumos, the underlying interfaces are broadly
// thread-safe. Further, Omicron only supports running tests under `cargo
// nextest`, in which case there are no threads running concurrently here
// that may be reading or modifying the environment.
for (env_var, _) in std::env::vars().filter(|(k, _)| k.starts_with("OMDB_"))
{
eprintln!("removing {:?} from environment", env_var);
std::env::remove_var(env_var);
}
}
3 changes: 0 additions & 3 deletions nexus/src/app/background/tasks/lookup_region_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl BackgroundTask for LookupRegionPort {
) -> BoxFuture<'a, serde_json::Value> {
async {
let log = &opctx.log;
info!(&log, "lookup region port task started");

let mut status = LookupRegionPortStatus::default();

Expand Down Expand Up @@ -147,8 +146,6 @@ impl BackgroundTask for LookupRegionPort {
}
}

info!(&log, "lookup region port task done");

json!(status)
}
.boxed()
Expand Down
4 changes: 1 addition & 3 deletions nexus/src/app/background/tasks/phantom_disks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl BackgroundTask for PhantomDiskDetector {
) -> BoxFuture<'a, serde_json::Value> {
async {
let log = &opctx.log;
warn!(&log, "phantom disk task started");

let phantom_disks = match self.datastore.find_phantom_disks().await
{
Expand Down Expand Up @@ -83,14 +82,13 @@ impl BackgroundTask for PhantomDiskDetector {
} else {
info!(
&log,
"phandom disk {} un-deleted andset to faulted ok",
"phandom disk {} un-deleted and set to faulted ok",
disk.id(),
);
phantom_disk_deleted_ok += 1;
}
}

warn!(&log, "phantom disk task done");
json!({
"phantom_disk_deleted_ok": phantom_disk_deleted_ok,
"phantom_disk_deleted_err": phantom_disk_deleted_err,
Expand Down
3 changes: 0 additions & 3 deletions nexus/src/app/background/tasks/physical_disk_adoption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ impl BackgroundTask for PhysicalDiskAdoption {
}

let mut disks_added = 0;
let log = &opctx.log;
warn!(&log, "physical disk adoption task started");

let collection_id = *self.rx_inventory_collection.borrow();
let Some(collection_id) = collection_id else {
Expand Down Expand Up @@ -171,7 +169,6 @@ impl BackgroundTask for PhysicalDiskAdoption {
);
}

warn!(&log, "physical disk adoption task done");
json!({
"physical_disks_added": disks_added,
})
Expand Down
3 changes: 0 additions & 3 deletions nexus/src/app/background/tasks/region_replacement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl BackgroundTask for RegionReplacementDetector {
) -> BoxFuture<'a, serde_json::Value> {
async {
let log = &opctx.log;
warn!(&log, "region replacement task started");

let mut ok = 0;
let mut err = 0;
Expand Down Expand Up @@ -182,8 +181,6 @@ impl BackgroundTask for RegionReplacementDetector {
}
}

warn!(&log, "region replacement task done");

json!({
"region_replacement_started_ok": ok,
"region_replacement_started_err": err,
Expand Down
5 changes: 0 additions & 5 deletions nexus/src/app/background/tasks/region_replacement_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,11 @@ impl BackgroundTask for RegionReplacementDriver {
opctx: &'a OpContext,
) -> BoxFuture<'a, serde_json::Value> {
async {
let log = &opctx.log;
info!(&log, "region replacement driver task started");

let mut status = RegionReplacementDriverStatus::default();

self.drive_running_replacements_forward(opctx, &mut status).await;
self.complete_done_replacements(opctx, &mut status).await;

info!(&log, "region replacement driver task done");

json!(status)
}
.boxed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ impl BackgroundTask for RegionSnapshotReplacementGarbageCollect {
opctx: &'a OpContext,
) -> BoxFuture<'a, serde_json::Value> {
async move {
let log = &opctx.log;
info!(
&log,
"region snapshot replacement garbage collect task started",
);

let mut status =
RegionSnapshotReplacementGarbageCollectStatus::default();

Expand All @@ -144,11 +138,6 @@ impl BackgroundTask for RegionSnapshotReplacementGarbageCollect {
)
.await;

info!(
&log,
"region snapshot replacement garbage collect task done"
);

json!(status)
}
.boxed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ impl BackgroundTask for RegionSnapshotReplacementDetector {
opctx: &'a OpContext,
) -> BoxFuture<'a, serde_json::Value> {
async {
let log = &opctx.log;
info!(&log, "region snapshot replacement start task started");

let mut status = RegionSnapshotReplacementStartStatus::default();

self.create_requests_for_region_snapshots_on_expunged_disks(
Expand All @@ -249,8 +246,6 @@ impl BackgroundTask for RegionSnapshotReplacementDetector {
)
.await;

info!(&log, "region snapshot replacement start task done");

json!(status)
}
.boxed()
Expand Down
1 change: 1 addition & 0 deletions nexus/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

//! Integration testing facilities for Nexus
#[cfg(feature = "omicron-dev")]
use anyhow::Context;
use anyhow::Result;
use camino::Utf8Path;
Expand Down
3 changes: 3 additions & 0 deletions oximeter/schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ license = "MPL-2.0"
workspace = true

[dependencies]
anyhow.workspace = true
chrono.workspace = true
clap.workspace = true
heck.workspace = true
omicron-workspace-hack.workspace = true
oximeter-types.workspace = true
prettyplease.workspace = true
proc-macro2.workspace = true
quote.workspace = true
schemars.workspace = true
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tools/console_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="17ae890c68a5277fbefe773694e790a8f1b178b4"
SHA2="273a31ba14546305bfafeb9aedb2d9a7530328a0359cda363380c9ca3240b948"
COMMIT="33b7a505a222b258a155636e8ee79c7ee3c132d2"
SHA2="f9089e18d52d7a54149b364a0b3ae4efba421c13eca6f7752a23b74dc3fa1a8e"

0 comments on commit dc79778

Please sign in to comment.