File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
//! The definition for host system state.
2
2
3
+ use std:: fmt:: Display ;
4
+
5
+ use ostree_ext:: container:: OstreeImageReference ;
3
6
use schemars:: JsonSchema ;
4
7
use serde:: { Deserialize , Serialize } ;
5
8
@@ -149,8 +152,17 @@ impl Default for Host {
149
152
}
150
153
}
151
154
155
+ impl Display for ImageReference {
156
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
157
+ let ostree_imgref = OstreeImageReference :: from ( self . clone ( ) ) ;
158
+ ostree_imgref. fmt ( f)
159
+ }
160
+ }
161
+
152
162
#[ cfg( test) ]
153
163
mod tests {
164
+ use std:: str:: FromStr ;
165
+
154
166
use super :: * ;
155
167
156
168
#[ test]
@@ -183,4 +195,13 @@ mod tests {
183
195
Some ( ImageSignature :: OstreeRemote ( "fedora" . into( ) ) )
184
196
) ;
185
197
}
198
+
199
+ #[ test]
200
+ fn test_display_imgref ( ) {
201
+ let src = "ostree-unverified-registry:quay.io/example/foo:sometag" ;
202
+ let s = OstreeImageReference :: from_str ( src) . unwrap ( ) ;
203
+ let s = ImageReference :: from ( s) ;
204
+ let displayed = format ! ( "{s}" ) ;
205
+ assert_eq ! ( displayed. as_str( ) , src) ;
206
+ }
186
207
}
You can’t perform that action at this time.
0 commit comments