@@ -8,7 +8,7 @@ use iroh_blobs::{
8
8
client:: tags:: { self , TagInfo } ,
9
9
proto:: RpcService ,
10
10
} ,
11
- BlobFormat , Hash , HashAndFormat ,
11
+ Hash , HashAndFormat ,
12
12
} ;
13
13
use testresult:: TestResult ;
14
14
@@ -19,11 +19,7 @@ async fn to_vec<T>(stream: impl Stream<Item = anyhow::Result<T>>) -> anyhow::Res
19
19
20
20
fn expected ( tags : impl IntoIterator < Item = & ' static str > ) -> Vec < TagInfo > {
21
21
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) ) )
27
23
. collect ( )
28
24
}
29
25
@@ -89,11 +85,7 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
89
85
90
86
assert_eq ! (
91
87
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" ) ) )
97
89
) ;
98
90
99
91
tags. delete ( "b" ) . await ?;
@@ -103,7 +95,7 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
103
95
104
96
assert_eq ! ( tags. get( "b" ) . await ?, None ) ;
105
97
106
- tags. delete_prefix ( "" ) . await ?;
98
+ tags. delete_all ( ) . await ?;
107
99
108
100
tags. set ( "a" , HashAndFormat :: hash_seq ( Hash :: new ( "a" ) ) )
109
101
. await ?;
@@ -115,9 +107,26 @@ async fn tags_smoke<C: quic_rpc::Connector<RpcService>>(tags: tags::Client<C>) -
115
107
vec![ TagInfo {
116
108
name: "a" . into( ) ,
117
109
hash: Hash :: new( "a" ) ,
118
- format: BlobFormat :: HashSeq ,
119
- } , ]
110
+ format: iroh_blobs :: BlobFormat :: HashSeq ,
111
+ } ]
120
112
) ;
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( ) ) ;
121
130
Ok ( ( ) )
122
131
}
123
132
0 commit comments