@@ -19,7 +19,14 @@ all() ->
1919 ].
2020
2121groups () ->
22- CommonTests = [get_empty , get_put , get_expired , put_replace , get_deleted , random_timing ],
22+ CommonTests = [
23+ get_empty ,
24+ get_put ,
25+ get_expired ,
26+ put_replace ,
27+ get_deleted ,
28+ random_timing ,
29+ clear ],
2330 [
2431 {rabbit_auth_cache_dict , [sequence ], CommonTests },
2532 {rabbit_auth_cache_ets , [sequence ], CommonTests },
@@ -153,6 +160,20 @@ get_deleted(Config) ->
153160 AuthCacheModule :delete (Key ),
154161 {error , not_found } = AuthCacheModule :get (Key ).
155162
163+ clear (Config ) ->
164+ AuthCacheModule = ? config (auth_cache_module , Config ),
165+ Key1 = some_key1 ,
166+ Key2 = some_key2 ,
167+ TTL = ? config (current_ttl , Config ),
168+ {error , not_found } = AuthCacheModule :get (Key1 ),
169+ {error , not_found } = AuthCacheModule :get (Key2 ),
170+ ok = AuthCacheModule :put (Key1 , some_value , TTL ),
171+ ok = AuthCacheModule :put (Key2 , some_value , TTL ),
172+ {ok , some_value } = AuthCacheModule :get (Key1 ),
173+ {ok , some_value } = AuthCacheModule :get (Key2 ),
174+ AuthCacheModule :clear (),
175+ {error , not_found } = AuthCacheModule :get (Key1 ),
176+ {error , not_found } = AuthCacheModule :get (Key2 ).
156177
157178random_timing (Config ) ->
158179 random_timing (Config , 15000 , 1000 ).
0 commit comments