@@ -38,6 +38,20 @@ use std::str::FromStr;
3838type ControlPlaneTestContext =
3939 nexus_test_utils:: ControlPlaneTestContext < omicron_nexus:: Server > ;
4040
41+ /// Strip lines starting with `#` from a snapshot file so that the file
42+ /// can contain human-readable comments explaining why each entry is there.
43+ fn strip_comments ( s : & str ) -> String {
44+ let mut out: String = s
45+ . lines ( )
46+ . filter ( |line| !line. starts_with ( '#' ) )
47+ . collect :: < Vec < _ > > ( )
48+ . join ( "\n " ) ;
49+ if s. ends_with ( '\n' ) {
50+ out. push ( '\n' ) ;
51+ }
52+ out
53+ }
54+
4155fn to_q ( d : DateTime < Utc > ) -> String {
4256 d. to_rfc3339_opts ( chrono:: SecondsFormat :: Micros , true )
4357}
@@ -711,7 +725,9 @@ async fn test_audit_log_coverage(ctx: &ControlPlaneTestContext) {
711725
712726 // Print a helpful message when there are new uncovered endpoints
713727 let expected_path = "tests/output/uncovered-audit-log-endpoints.txt" ;
714- let expected = std:: fs:: read_to_string ( expected_path) . unwrap_or_default ( ) ;
728+ let expected = strip_comments (
729+ & std:: fs:: read_to_string ( expected_path) . unwrap_or_default ( ) ,
730+ ) ;
715731 let expected_ops: std:: collections:: HashSet < & str > = expected
716732 . lines ( )
717733 . skip ( 1 ) // skip the header line
@@ -767,8 +783,9 @@ async fn test_audit_log_coverage(ctx: &ControlPlaneTestContext) {
767783 }
768784
769785 let get_expected_path = "tests/output/audited-get-endpoints.txt" ;
770- let get_expected =
771- std:: fs:: read_to_string ( get_expected_path) . unwrap_or_default ( ) ;
786+ let get_expected = strip_comments (
787+ & std:: fs:: read_to_string ( get_expected_path) . unwrap_or_default ( ) ,
788+ ) ;
772789 let get_expected_ops: std:: collections:: HashSet < & str > = get_expected
773790 . lines ( )
774791 . skip ( 1 ) // skip the header line
0 commit comments