Skip to content

Commit 9d862ff

Browse files
committed
Let tests pass on earlier redis-servers
1 parent 9af8568 commit 9d862ff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

t/23-stream.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ TEST_CASE("stream", "[connection]") {
4545
r::Connection<next_layer_t> c(std::move(socket));
4646

4747
Buffer rx_buff;
48+
c.write(r::single_command_t{ "INFO" });
49+
auto parse_result0 = c.read(rx_buff);
50+
auto extract0 = boost::apply_visitor(Extractor(), parse_result0.result);
51+
auto info = boost::get<r::extracts::string_t>(extract0);
52+
rx_buff.consume(parse_result0.consumed);
53+
auto it_begin = info.str.begin();
54+
auto it_end = info.str.end();
55+
std::string version_str = "redis_version:5.";
56+
if (info.str.find("redis_version:5.") == std::string::npos) {
57+
/* not supported by earlier redis versions */
58+
return;
59+
}
60+
61+
4862
c.write(r::single_command_t{ "XADD", "mystream", "*", "cpu-temp", "23.4", "load", "2.3" });
4963
auto parse_result1 = c.read(rx_buff);
5064
auto extract1 = boost::apply_visitor(Extractor(), parse_result1.result);

0 commit comments

Comments
 (0)