Skip to content

Commit

Permalink
unbreak expected metric fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed May 8, 2024
1 parent 75dac39 commit 8392b12
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions nexus/tests/integration_tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ async fn test_instance_watcher_metrics(
cptestctx: &ControlPlaneTestContext<omicron_nexus::Server>,
) {
use oximeter::types::FieldValue;
const INSTANCE_ID_FIELD: &str = "instance_id";
const STATE_FIELD: &str = "state";
const STATE_STARTING: &str = "starting";

let client = &cptestctx.external_client;
let internal_client = &cptestctx.internal_client;
Expand Down Expand Up @@ -359,13 +362,13 @@ async fn test_instance_watcher_metrics(
let ts = checks
.timeseries()
.find(|ts| {
ts.fields.get("instance_id").unwrap()
ts.fields.get(INSTANCE_ID_FIELD).unwrap()
== &FieldValue::Uuid(instance1_uuid)
})
.expect("missing timeseries for instance1 checks");
assert_eq!(
ts.fields.get("status").unwrap(),
&FieldValue::String("starting".to_string())
ts.fields.get(STATE_FIELD).unwrap(),
&FieldValue::String(STATE_STARTING.to_string())
);

// okay, make another instance
Expand All @@ -384,24 +387,24 @@ async fn test_instance_watcher_metrics(
let ts1 = checks
.timeseries()
.find(|ts| {
ts.fields.get("instance_id").unwrap()
ts.fields.get(INSTANCE_ID_FIELD).unwrap()
== &FieldValue::Uuid(instance1_uuid)
})
.expect("missing timeseries for instance1 checks");
let ts2 = checks
.timeseries()
.find(|ts| {
ts.fields.get("instance_id").unwrap()
ts.fields.get(INSTANCE_ID_FIELD).unwrap()
== &FieldValue::Uuid(instance2_uuid)
})
.expect("missing timeseries for instance2 checks");
assert_eq!(
ts1.fields.get("status").unwrap(),
&FieldValue::String("starting".to_string())
ts1.fields.get(STATE_FIELD).unwrap(),
&FieldValue::String(STATE_STARTING.to_string())
);
assert_eq!(
ts2.fields.get("status").unwrap(),
&FieldValue::String("starting".to_string())
ts2.fields.get(STATE_FIELD).unwrap(),
&FieldValue::String(STATE_STARTING.to_string())
);
}

Expand Down

0 comments on commit 8392b12

Please sign in to comment.