@@ -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,7 +95,7 @@ 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 ?;
@@ -115,9 +107,26 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
115107 vec![ TagInfo {
116108 name: "a" . into( ) ,
117109 hash: Hash :: new( "a" ) ,
118- format: BlobFormat :: HashSeq ,
119- } , ]
110+ format: iroh_blobs :: BlobFormat :: HashSeq ,
111+ } ]
120112 ) ;
113+
114+ tags. delete_all ( ) . await ?;
115+ set ( & tags, [ "c" ] ) . await ?;
116+ tags. rename ( "c" , "f" ) . await ?;
117+ let stream = tags. list ( ) . await ?;
118+ let res = to_vec ( stream) . await ?;
119+ assert_eq ! (
120+ res,
121+ vec![ TagInfo {
122+ name: "f" . into( ) ,
123+ hash: Hash :: new( "c" ) ,
124+ format: iroh_blobs:: BlobFormat :: Raw ,
125+ } ]
126+ ) ;
127+
128+ let res = tags. rename ( "y" , "z" ) . await ;
129+ assert ! ( res. is_err( ) ) ;
121130 Ok ( ( ) )
122131}
123132
0 commit comments