Skip to content

Commit 6bd58fe

Browse files
RUST-1474 Fix JSON file construction in workload executor (#752)
1 parent fe018f6 commit 6bd58fe

File tree

1 file changed

+17
-14
lines changed
  • src/test/atlas_planned_maintenance_testing

1 file changed

+17
-14
lines changed

src/test/atlas_planned_maintenance_testing/mod.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// NOTE: Please run a patch against drivers-atlas-testing when making changes within this file. The
2+
// DRIVER_REPOSITORY and DRIVER_REVISION fields for the Rust axis in drivers-atlas-testing's
3+
// evergreen config file can be updated to test against your branch.
4+
15
mod json_models;
26

37
use std::{
@@ -132,20 +136,19 @@ fn write_json(entities: &mut EntityMap, mut errors: Vec<Bson>) {
132136
// The events key is expected to be present regardless of whether storeEventsAsEntities was
133137
// defined.
134138
write!(&mut writer, ",\"events\":[").unwrap();
135-
let event_list_entity = match entities.get("events") {
136-
Some(entity) => entity.as_event_list().to_owned(),
137-
None => return,
138-
};
139-
let client = entities
140-
.get(&event_list_entity.client_id)
141-
.unwrap()
142-
.as_client();
143-
let names: Vec<&str> = event_list_entity
144-
.event_names
145-
.iter()
146-
.map(String::as_ref)
147-
.collect();
148-
client.write_events_list_to_file(&names, &mut writer);
139+
if let Some(entity) = entities.get("events") {
140+
let event_list_entity = entity.as_event_list().to_owned();
141+
let client = entities
142+
.get(&event_list_entity.client_id)
143+
.unwrap()
144+
.as_client();
145+
let names: Vec<&str> = event_list_entity
146+
.event_names
147+
.iter()
148+
.map(String::as_ref)
149+
.collect();
150+
client.write_events_list_to_file(&names, &mut writer);
151+
}
149152
write!(&mut writer, "]}}").unwrap();
150153

151154
let mut results_path = PathBuf::from(&path);

0 commit comments

Comments
 (0)