33// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
55//! Functions related to management of measurement corpus
6- use camino:: Utf8PathBuf ;
6+ use camino:: { Utf8Path , Utf8PathBuf } ;
77//use sled_storage::dataset::INSTALL_DATASET;
88//use sled_storage::manager::StorageHandle;
99use sled_agent_config_reconciler:: InternalDisksReceiver ;
@@ -15,6 +15,8 @@ pub enum MeasurementError {
1515 MissingInstallSet ,
1616 #[ error( "io: {0}" ) ]
1717 Io ( std:: io:: Error ) ,
18+ #[ error( "Missing boot disk" ) ]
19+ MissingBootDisk ,
1820}
1921
2022/// Access the measurements in the install directory
@@ -27,24 +29,25 @@ pub async fn sled_new_measurement_paths(
2729 let current = receiver. current ( ) ;
2830
2931 dirs. push (
30- current. boot_disk_install_dataset ( ) . unwrap ( ) . join ( "measurements" ) ,
32+ current
33+ . boot_disk_install_dataset ( )
34+ . ok_or ( MeasurementError :: MissingBootDisk ) ?
35+ . join ( "measurements" ) ,
3136 ) ;
3237
33- //for (_, d) in current.non_boot_disk_install_datasets() {
34- // dirs.push(d.join("measurements"));
35- //}
36-
37- //let resources = storage.get_latest_disks().await;
38- //let dirs: Vec<_> = resources
39- // .all_m2_mountpoints(INSTALL_DATASET)
40- // .into_iter()
41- // .map(|p| p.join("measurements"))
42- // .collect();
43-
4438 if dirs. is_empty ( ) {
4539 return Err ( MeasurementError :: MissingInstallSet ) ;
4640 }
4741
42+ // We don't have an install dataset for our automated deployment
43+ // testing. Instead, rely on the files getting copied/packaged.
44+ let testing_corpus_path =
45+ Utf8Path :: new ( "/opt/oxide/sled-agent/pkg/testing-measurements" ) ;
46+
47+ if testing_corpus_path. is_dir ( ) {
48+ dirs. push ( testing_corpus_path. into ( ) ) ;
49+ }
50+
4851 for dir in dirs {
4952 match dir. read_dir_utf8 ( ) {
5053 Ok ( iter) => {
0 commit comments