@@ -33,7 +33,13 @@ class RedisBigSegmentTests : public ::testing::Test {
3333
3434 void AddIncludes (std::string const & context_hash,
3535 std::vector<std::string> const & refs) {
36- auto const key = prefix_ + " :big_segment_include:" + context_hash;
36+ AddIncludesUnderPrefix (prefix_, context_hash, refs);
37+ }
38+
39+ void AddIncludesUnderPrefix (std::string const & prefix,
40+ std::string const & context_hash,
41+ std::vector<std::string> const & refs) {
42+ auto const key = prefix + " :big_segment_include:" + context_hash;
3743 for (auto const & ref : refs) {
3844 client_.sadd (key, ref);
3945 }
@@ -48,8 +54,11 @@ class RedisBigSegmentTests : public ::testing::Test {
4854 }
4955
5056 void SetSyncTime (std::int64_t millis) {
51- client_.set (prefix_ + " :big_segments_synchronized_on" ,
52- std::to_string (millis));
57+ SetSyncTimeRaw (std::to_string (millis));
58+ }
59+
60+ void SetSyncTimeRaw (std::string const & value) {
61+ client_.set (prefix_ + " :big_segments_synchronized_on" , value);
5362 }
5463
5564 protected:
@@ -58,8 +67,6 @@ class RedisBigSegmentTests : public ::testing::Test {
5867 private:
5968 std::string const uri_;
6069 std::string const prefix_;
61-
62- protected:
6370 sw::redis::Redis client_;
6471};
6572
@@ -113,8 +120,7 @@ TEST_F(RedisBigSegmentTests, GetMembershipInclusionWinsOverExclusion) {
113120
114121TEST_F (RedisBigSegmentTests, GetMembershipIsPrefixScoped) {
115122 // Write under a different prefix; same-named test store should not see it.
116- auto const other_prefix_key = " otherprefix:big_segment_include:alice" ;
117- client_.sadd (other_prefix_key, " seg1.g1" );
123+ AddIncludesUnderPrefix (" otherprefix" , " alice" , {" seg1.g1" });
118124
119125 auto const result = store_->GetMembership (" alice" );
120126 ASSERT_TRUE (result);
@@ -132,8 +138,7 @@ TEST_F(RedisBigSegmentTests, GetMetadataReturnsSyncTime) {
132138}
133139
134140TEST_F (RedisBigSegmentTests, GetMetadataRejectsMalformedSyncTime) {
135- client_.set (std::string (" testprefix:big_segments_synchronized_on" ),
136- " not-a-number" );
141+ SetSyncTimeRaw (" not-a-number" );
137142
138143 auto const result = store_->GetMetadata ();
139144 ASSERT_FALSE (result);
0 commit comments