diff --git a/spec/time_series_spec.cr b/spec/time_series_spec.cr index b29f86b..568581e 100644 --- a/spec/time_series_spec.cr +++ b/spec/time_series_spec.cr @@ -120,14 +120,19 @@ module Redis it "gets the index names for a given filter" do included_key = UUID.random.to_s excluded_key = UUID.random.to_s - name_label = UUID.random.to_s - redis.ts.create included_key, labels: { "name" => name_label, } - redis.ts.create excluded_key, labels: { "name" => UUID.random.to_s, } - names = redis.ts.queryindex("name=#{name_label}").as(Array) + begin + name_label = UUID.random.to_s + redis.ts.create included_key, labels: {"name" => name_label} + redis.ts.create excluded_key, labels: {"name" => UUID.random.to_s} - names.should contain included_key - names.should_not contain excluded_key + names = redis.ts.queryindex("name=#{name_label}").as(Array) + + names.should contain included_key + names.should_not contain excluded_key + ensure + redis.unlink included_key, excluded_key + end end end end