@@ -8,7 +8,7 @@ use iroh_blobs::{
88 client:: tags:: { self , TagInfo } ,
99 proto:: RpcService ,
1010 } ,
11- BlobFormat , Hash , HashAndFormat ,
11+ Hash , HashAndFormat ,
1212} ;
1313use testresult:: TestResult ;
1414
@@ -19,11 +19,7 @@ async fn to_vec<T>(stream: impl Stream<Item = anyhow::Result<T>>) -> anyhow::Res
1919
2020fn expected ( tags : impl IntoIterator < Item = & ' static str > ) -> Vec < TagInfo > {
2121 tags. into_iter ( )
22- . map ( |tag| TagInfo {
23- name : tag. into ( ) ,
24- hash : Hash :: new ( tag) ,
25- format : BlobFormat :: Raw ,
26- } )
22+ . map ( |tag| TagInfo :: new ( tag, Hash :: new ( tag) ) )
2723 . collect ( )
2824}
2925
@@ -89,11 +85,7 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
8985
9086 assert_eq ! (
9187 tags. get( "b" ) . await ?,
92- Some ( TagInfo {
93- name: "b" . into( ) ,
94- hash: Hash :: new( "b" ) ,
95- format: BlobFormat :: Raw ,
96- } )
88+ Some ( TagInfo :: new( "b" , Hash :: new( "b" ) ) )
9789 ) ;
9890
9991 tags. delete ( "b" ) . await ?;
@@ -103,21 +95,32 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
10395
10496 assert_eq ! ( tags. get( "b" ) . await ?, None ) ;
10597
106- tags. delete_prefix ( "" ) . await ?;
98+ tags. delete_all ( ) . await ?;
10799
108100 tags. set ( "a" , HashAndFormat :: hash_seq ( Hash :: new ( "a" ) ) )
109101 . await ?;
110102 tags. set ( "b" , HashAndFormat :: raw ( Hash :: new ( "b" ) ) ) . await ?;
111103 let stream = tags. list_hash_seq ( ) . await ?;
112104 let res = to_vec ( stream) . await ?;
113- assert_eq ! (
114- res,
115- vec![ TagInfo {
116- name: "a" . into( ) ,
117- hash: Hash :: new( "a" ) ,
118- format: BlobFormat :: HashSeq ,
119- } , ]
120- ) ;
105+ assert_eq ! ( res, vec![ TagInfo {
106+ name: "a" . into( ) ,
107+ hash: Hash :: new( "a" ) ,
108+ format: iroh_blobs:: BlobFormat :: HashSeq ,
109+ } ] ) ;
110+
111+ tags. delete_all ( ) . await ?;
112+ set ( & tags, [ "c" ] ) . await ?;
113+ tags. rename ( "c" , "f" ) . await ?;
114+ let stream = tags. list ( ) . await ?;
115+ let res = to_vec ( stream) . await ?;
116+ assert_eq ! ( res, vec![ TagInfo {
117+ name: "f" . into( ) ,
118+ hash: Hash :: new( "c" ) ,
119+ format: iroh_blobs:: BlobFormat :: Raw ,
120+ } ] ) ;
121+
122+ let res = tags. rename ( "y" , "z" ) . await ;
123+ assert ! ( res. is_err( ) ) ;
121124 Ok ( ( ) )
122125}
123126
0 commit comments