@@ -112,7 +112,7 @@ const MONGO_TRACER_INSTALLER: BinaryPin = BinaryPin {
112112/// A binary the runner downloads at install time. The download helper looks
113113/// up the URL and SHA-256 via `url()` and `sha256()` and rejects the install
114114/// if the bytes don't match.
115- #[ derive( Debug , Clone , Copy ) ]
115+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
116116pub enum PinnedBinary {
117117 ValgrindDeb {
118118 distro_version : & ' static str ,
@@ -144,33 +144,6 @@ impl PinnedBinary {
144144 self . pin ( ) . url ( )
145145 }
146146
147- /// Every `PinnedBinary` instance the runner can produce at runtime, used
148- /// by the verification test to catch a stale or mistyped hash before
149- /// release. Update this whenever a new variant or valgrind target is
150- /// added.
151- #[ cfg( test) ]
152- pub const ALL : & ' static [ PinnedBinary ] = & [
153- PinnedBinary :: ValgrindDeb {
154- distro_version : "22.04" ,
155- arch : "amd64" ,
156- } ,
157- PinnedBinary :: ValgrindDeb {
158- distro_version : "24.04" ,
159- arch : "amd64" ,
160- } ,
161- PinnedBinary :: ValgrindDeb {
162- distro_version : "22.04" ,
163- arch : "arm64" ,
164- } ,
165- PinnedBinary :: ValgrindDeb {
166- distro_version : "24.04" ,
167- arch : "arm64" ,
168- } ,
169- PinnedBinary :: MemtrackInstaller ,
170- PinnedBinary :: ExecHarnessInstaller ,
171- PinnedBinary :: MongoTracerInstaller ,
172- ] ;
173-
174147 pub fn sha256 ( & self ) -> & ' static str {
175148 self . pin ( ) . sha256 ( )
176149 }
@@ -182,21 +155,54 @@ mod tests {
182155 use crate :: cli:: run:: helpers:: download_pinned_file;
183156 use tempfile:: NamedTempFile ;
184157
158+ const INSTALLER_BINARIES : & [ PinnedBinary ] = & [
159+ PinnedBinary :: MemtrackInstaller ,
160+ PinnedBinary :: ExecHarnessInstaller ,
161+ PinnedBinary :: MongoTracerInstaller ,
162+ ] ;
163+
164+ fn assert_installer_variant_is_listed ( binary : PinnedBinary ) {
165+ match binary {
166+ PinnedBinary :: ValgrindDeb { .. } => { }
167+ PinnedBinary :: MemtrackInstaller
168+ | PinnedBinary :: ExecHarnessInstaller
169+ | PinnedBinary :: MongoTracerInstaller => {
170+ assert ! ( INSTALLER_BINARIES . contains( & binary) ) ;
171+ }
172+ }
173+ }
174+
175+ fn all_pinned_binaries ( ) -> impl Iterator < Item = PinnedBinary > {
176+ VALGRIND_DEBS
177+ . iter ( )
178+ . map ( |pin| PinnedBinary :: ValgrindDeb {
179+ distro_version : pin. distro_version ,
180+ arch : pin. arch ,
181+ } )
182+ . chain ( INSTALLER_BINARIES . iter ( ) . copied ( ) )
183+ }
184+
185+ #[ test]
186+ fn installer_variant_list_is_exhaustive ( ) {
187+ assert_installer_variant_is_listed ( PinnedBinary :: MemtrackInstaller ) ;
188+ assert_installer_variant_is_listed ( PinnedBinary :: ExecHarnessInstaller ) ;
189+ assert_installer_variant_is_listed ( PinnedBinary :: MongoTracerInstaller ) ;
190+ }
191+
185192 // Network-bound: downloads every pinned URL and asserts its bytes hash to
186193 // the declared SHA-256. Skipped locally; CI sets `GITHUB_ACTIONS=true`.
187194 // Run after bumping a version to make sure the release won't ship a stale
188195 // or mistyped hash.
189196 #[ test_with:: env( GITHUB_ACTIONS ) ]
190197 #[ tokio:: test( flavor = "multi_thread" ) ]
191198 async fn all_pinned_binaries_match_their_declared_sha256 ( ) {
192- let results =
193- futures:: future:: join_all ( PinnedBinary :: ALL . iter ( ) . map ( |binary| async move {
194- let temp = NamedTempFile :: new ( ) . expect ( "failed to create temp file" ) ;
195- download_pinned_file ( * binary, temp. path ( ) )
196- . await
197- . map_err ( |e| format ! ( "{binary:?} ({}): {e}" , binary. url( ) ) )
198- } ) )
199- . await ;
199+ let results = futures:: future:: join_all ( all_pinned_binaries ( ) . map ( |binary| async move {
200+ let temp = NamedTempFile :: new ( ) . expect ( "failed to create temp file" ) ;
201+ download_pinned_file ( binary, temp. path ( ) )
202+ . await
203+ . map_err ( |e| format ! ( "{binary:?} ({}): {e}" , binary. url( ) ) )
204+ } ) )
205+ . await ;
200206
201207 let failures: Vec < _ > = results. into_iter ( ) . filter_map ( Result :: err) . collect ( ) ;
202208 assert ! (
0 commit comments