From 6c96312e92892f7a00c492456f896670b9e05d6b Mon Sep 17 00:00:00 2001 From: Jamie Gaskins Date: Wed, 15 Nov 2023 14:47:39 -0600 Subject: [PATCH] Fix keys leaked in TimeSeries spec Forgot to clean up after this. Usually the `test` macro handles this, but we needed 2 keys here and that macro only supplies 1, so we had to do this manually. --- spec/time_series_spec.cr | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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